Skip to content

Commit 352d3bb

Browse files
committed
fix: ensure entry chunk is placed last for CSS overrides
1 parent 77f7f9a commit 352d3bb

File tree

1 file changed

+10
-2
lines changed
  • packages/@vue/cli-service/lib/config

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,18 @@ module.exports = (api, options) => {
8282
// more options:
8383
// https://github.com/kangax/html-minifier#options-quick-reference
8484
},
85-
// default sort mode uses toposort which cannot handle cyclic deps
85+
// #1669 default sort mode uses toposort which cannot handle cyclic deps
8686
// in certain cases, and in webpack 4, chunk order in HTML doesn't
8787
// matter anyway
88-
chunksSortMode: 'none'
88+
chunksSortMode: (a, b) => {
89+
if (a.entry !== b.entry) {
90+
// make sure entry is loaded last so user CSS can override
91+
// vendor CSS
92+
return b.entry ? -1 : 1
93+
} else {
94+
return 0
95+
}
96+
}
8997
})
9098

9199
// keep chunk ids stable so async chunks have consistent hash (#1916)

0 commit comments

Comments
 (0)