Skip to content

Commit bd3f65b

Browse files
Sayuti Danieltimneutkens
authored andcommitted
Use contenthash instead of chunkhash (#4894)
webpack/webpack.js.org#2096
1 parent b492e67 commit bd3f65b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build/webpack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
156156
output: {
157157
path: outputPath,
158158
filename: ({chunk}) => {
159-
// Use `[name]-[chunkhash].js` in production
159+
// Use `[name]-[contenthash].js` in production
160160
if (!dev && (chunk.name === CLIENT_STATIC_FILES_RUNTIME_MAIN || chunk.name === CLIENT_STATIC_FILES_RUNTIME_WEBPACK)) {
161-
return chunk.name.replace(/\.js$/, '-' + chunk.renderedHash + '.js')
161+
return chunk.name.replace(/\.js$/, '-' + chunk.contentHash.javascript + '.js')
162162
}
163163
return '[name]'
164164
},
165165
libraryTarget: 'commonjs2',
166166
hotUpdateChunkFilename: 'static/webpack/[id].[hash].hot-update.js',
167167
hotUpdateMainFilename: 'static/webpack/[hash].hot-update.json',
168168
// This saves chunks with the name given via `import()`
169-
chunkFilename: isServer ? `${dev ? '[name]' : '[chunkhash]'}.js` : `static/chunks/${dev ? '[name]' : '[chunkhash]'}.js`,
169+
chunkFilename: isServer ? `${dev ? '[name]' : '[contenthash]'}.js` : `static/chunks/${dev ? '[name]' : '[contenthash]'}.js`,
170170
strictModuleExceptionHandling: true
171171
},
172172
performance: { hints: false },

0 commit comments

Comments
 (0)