Unverified Commit 288984b1 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

enable contenthashing in webpack 5 (#25055)

This improves long term caching by avoiding hash changes

workaround fix #25013 
The real problem is fixed by #24573

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
parent 5f3351db
......@@ -902,13 +902,13 @@ export default async function getBaseWebpackConfig(
isServer && isWebpack5 && !dev
? path.join(outputPath, 'chunks')
: outputPath,
// On the server we don't use the chunkhash
// On the server we don't use hashes
filename: isServer
? isWebpack5 && !dev
? '../[name].js'
: '[name].js'
: `static/chunks/${isDevFallback ? 'fallback/' : ''}[name]${
dev ? '' : '-[chunkhash]'
dev ? '' : isWebpack5 ? '-[contenthash]' : '-[chunkhash]'
}.js`,
library: isServer ? undefined : '_N_E',
libraryTarget: isServer ? 'commonjs2' : 'assign',
......@@ -1284,9 +1284,6 @@ export default async function getBaseWebpackConfig(
webpackConfig.cache = cache
// @ts-ignore TODO: remove ignore when webpack 5 is stable
webpackConfig.optimization.realContentHash = false
if (process.env.NEXT_WEBPACK_LOGGING) {
const logInfra = process.env.NEXT_WEBPACK_LOGGING.includes(
'infrastructure'
......
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