mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Use contenthash instead of chunkhash (#4894)
https://github.com/webpack/webpack.js.org/issues/2096
This commit is contained in:
parent
b492e6703d
commit
bd3f65b37f
|
@ -156,9 +156,9 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
|
|||
output: {
|
||||
path: outputPath,
|
||||
filename: ({chunk}) => {
|
||||
// Use `[name]-[chunkhash].js` in production
|
||||
// Use `[name]-[contenthash].js` in production
|
||||
if (!dev && (chunk.name === CLIENT_STATIC_FILES_RUNTIME_MAIN || chunk.name === CLIENT_STATIC_FILES_RUNTIME_WEBPACK)) {
|
||||
return chunk.name.replace(/\.js$/, '-' + chunk.renderedHash + '.js')
|
||||
return chunk.name.replace(/\.js$/, '-' + chunk.contentHash.javascript + '.js')
|
||||
}
|
||||
return '[name]'
|
||||
},
|
||||
|
@ -166,7 +166,7 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
|
|||
hotUpdateChunkFilename: 'static/webpack/[id].[hash].hot-update.js',
|
||||
hotUpdateMainFilename: 'static/webpack/[hash].hot-update.json',
|
||||
// This saves chunks with the name given via `import()`
|
||||
chunkFilename: isServer ? `${dev ? '[name]' : '[chunkhash]'}.js` : `static/chunks/${dev ? '[name]' : '[chunkhash]'}.js`,
|
||||
chunkFilename: isServer ? `${dev ? '[name]' : '[contenthash]'}.js` : `static/chunks/${dev ? '[name]' : '[contenthash]'}.js`,
|
||||
strictModuleExceptionHandling: true
|
||||
},
|
||||
performance: { hints: false },
|
||||
|
|
Loading…
Reference in a new issue