Skip to content

Commit db26361

Browse files
committed
fix(build): ensure consistent chunk id for async chunks
close vuejs#1916
1 parent 8037647 commit db26361

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/@vue/cli-service/lib/config/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ module.exports = (api, options) => {
7272
// matter anyway
7373
chunksSortMode: 'none'
7474
})
75+
76+
// keep chunk ids stable so async chunks have consistent hash (#1916)
77+
webpackConfig
78+
.plugin('named-chunks')
79+
.use(require('webpack/lib/NamedChunksPlugin'), [chunk => {
80+
if (chunk.name) {
81+
return chunk.name
82+
}
83+
return `chunk-` + Array.from(chunk.modulesIterable, m => {
84+
return m.id
85+
}).join('_')
86+
}])
7587
}
7688

7789
// resolve HTML file(s)

packages/@vue/cli-service/lib/config/prod.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ module.exports = (api, options) => {
1919
// keep module.id stable when vendor modules does not change
2020
webpackConfig
2121
.plugin('hash-module-ids')
22-
.use(require('webpack/lib/HashedModuleIdsPlugin'))
22+
.use(require('webpack/lib/HashedModuleIdsPlugin'), [{
23+
hashDigest: 'hex'
24+
}])
2325

2426
// disable optimization during tests to speed things up
2527
if (process.env.VUE_CLI_TEST) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy