fix: ensure entry chunk is placed last for CSS overrides

This commit is contained in:
Evan You
2018-07-30 16:31:16 -04:00
parent 77f7f9ac77
commit 352d3bbcbe

View File

@@ -82,10 +82,18 @@ module.exports = (api, options) => {
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// default sort mode uses toposort which cannot handle cyclic deps
// #1669 default sort mode uses toposort which cannot handle cyclic deps
// in certain cases, and in webpack 4, chunk order in HTML doesn't
// matter anyway
chunksSortMode: 'none'
chunksSortMode: (a, b) => {
if (a.entry !== b.entry) {
// make sure entry is loaded last so user CSS can override
// vendor CSS
return b.entry ? -1 : 1
} else {
return 0
}
}
})
// keep chunk ids stable so async chunks have consistent hash (#1916)