File tree 1 file changed +10
-5
lines changed
packages/@vue/cli-service/lib/config
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,14 @@ module.exports = (api, options) => {
84
84
webpackConfig . entryPoints . clear ( )
85
85
86
86
const pages = Object . keys ( multiPageConfig )
87
+ const normalizePageConfig = c => typeof c === 'string' ? { entry : c } : c
87
88
88
89
pages . forEach ( name => {
89
90
const {
90
91
entry,
91
92
template = `public/${ name } .html` ,
92
93
filename = `${ name } .html`
93
- } = multiPageConfig [ name ]
94
+ } = normalizePageConfig ( multiPageConfig [ name ] )
94
95
// inject entry
95
96
webpackConfig . entry ( name ) . add ( api . resolve ( entry ) )
96
97
@@ -107,7 +108,9 @@ module.exports = (api, options) => {
107
108
} )
108
109
109
110
pages . forEach ( name => {
110
- const { filename = `${ name } .html` } = multiPageConfig [ name ]
111
+ const {
112
+ filename = `${ name } .html`
113
+ } = normalizePageConfig ( multiPageConfig [ name ] )
111
114
webpackConfig
112
115
. plugin ( `preload-${ name } ` )
113
116
. use ( PreloadPlugin , [ {
@@ -148,16 +151,18 @@ module.exports = (api, options) => {
148
151
if ( isProd ) {
149
152
webpackConfig
150
153
. optimization . splitChunks ( {
151
- chunks : 'all' ,
152
- name : ( m , chunks , cacheGroup ) => `chunk-${ cacheGroup } ` ,
153
154
cacheGroups : {
154
155
vendors : {
156
+ name : 'chunk-vendors' ,
155
157
test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ,
156
- priority : - 10
158
+ priority : - 10 ,
159
+ chunks : 'initial'
157
160
} ,
158
161
common : {
162
+ name : 'chunk-common' ,
159
163
minChunks : 2 ,
160
164
priority : - 20 ,
165
+ chunks : 'initial' ,
161
166
reuseExistingChunk : true
162
167
}
163
168
}
You can’t perform that action at this time.
0 commit comments