fix(build): ensure consistent chunk id for async chunks

close #1916
This commit is contained in:
Evan You
2018-07-26 16:40:31 -04:00
parent 80376470df
commit db2636151c
2 changed files with 15 additions and 1 deletions
@@ -72,6 +72,18 @@ module.exports = (api, options) => {
// matter anyway
chunksSortMode: 'none'
})
// keep chunk ids stable so async chunks have consistent hash (#1916)
webpackConfig
.plugin('named-chunks')
.use(require('webpack/lib/NamedChunksPlugin'), [chunk => {
if (chunk.name) {
return chunk.name
}
return `chunk-` + Array.from(chunk.modulesIterable, m => {
return m.id
}).join('_')
}])
}
// resolve HTML file(s)
+3 -1
View File
@@ -19,7 +19,9 @@ module.exports = (api, options) => {
// keep module.id stable when vendor modules does not change
webpackConfig
.plugin('hash-module-ids')
.use(require('webpack/lib/HashedModuleIdsPlugin'))
.use(require('webpack/lib/HashedModuleIdsPlugin'), [{
hashDigest: 'hex'
}])
// disable optimization during tests to speed things up
if (process.env.VUE_CLI_TEST) {