Unverified Commit e00e3c97 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure webpack cache is invalidated for alias change (#24956)

parent 6d0150f0
......@@ -1263,6 +1263,7 @@ export default async function getBaseWebpackConfig(
target,
reactProductionProfiling,
webpack: !!config.webpack,
hasRewrites,
})
const cache: any = {
......
module.exports = {
// target: 'serverless',
async rewrites() {
// no-rewrites comment
return {
afterFiles: [
...(process.env.ADD_NOOP_REWRITE === 'true'
......
......@@ -1731,12 +1731,33 @@ describe('Custom routes', () => {
})
describe('dev mode', () => {
let nextConfigContent
beforeAll(async () => {
// ensure cache with rewrites disabled doesn't persist
// after enabling rewrites
await fs.remove(join(appDir, '.next'))
nextConfigContent = await fs.readFile(nextConfigPath, 'utf8')
await fs.writeFile(
nextConfigPath,
nextConfigContent.replace('// no-rewrites comment', 'return []')
)
const tempPort = await findPort()
const tempApp = await launchApp(appDir, tempPort)
await renderViaHTTP(tempPort, '/')
await killApp(tempApp)
await fs.writeFile(nextConfigPath, nextConfigContent)
appPort = await findPort()
app = await launchApp(appDir, appPort)
buildId = 'development'
})
afterAll(() => killApp(app))
afterAll(async () => {
await fs.writeFile(nextConfigPath, nextConfigContent)
await killApp(app)
})
runTests(true)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment