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( ...@@ -1263,6 +1263,7 @@ export default async function getBaseWebpackConfig(
target, target,
reactProductionProfiling, reactProductionProfiling,
webpack: !!config.webpack, webpack: !!config.webpack,
hasRewrites,
}) })
const cache: any = { const cache: any = {
......
module.exports = { module.exports = {
// target: 'serverless', // target: 'serverless',
async rewrites() { async rewrites() {
// no-rewrites comment
return { return {
afterFiles: [ afterFiles: [
...(process.env.ADD_NOOP_REWRITE === 'true' ...(process.env.ADD_NOOP_REWRITE === 'true'
......
...@@ -1731,12 +1731,33 @@ describe('Custom routes', () => { ...@@ -1731,12 +1731,33 @@ describe('Custom routes', () => {
}) })
describe('dev mode', () => { describe('dev mode', () => {
let nextConfigContent
beforeAll(async () => { 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() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
buildId = 'development' buildId = 'development'
}) })
afterAll(() => killApp(app)) afterAll(async () => {
await fs.writeFile(nextConfigPath, nextConfigContent)
await killApp(app)
})
runTests(true) 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