File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -118,9 +118,13 @@ module.exports = (api, options) => {
118118
119119 api . configureWebpack ( ( webpackConfig ) => {
120120 const omitUserScripts = ( { name } ) => ! userScripts . includes ( name )
121- if ( isProduction ) {
122- webpackConfig . optimization . splitChunks . cacheGroups . vendors . chunks = omitUserScripts
123- webpackConfig . optimization . splitChunks . cacheGroups . common . chunks = omitUserScripts
121+ if ( webpackConfig . optimization && webpackConfig . optimization . splitChunks && webpackConfig . optimization . splitChunks . cacheGroups ) {
122+ if ( webpackConfig . optimization . splitChunks . cacheGroups . vendors ) {
123+ webpackConfig . optimization . splitChunks . cacheGroups . vendors . chunks = omitUserScripts
124+ }
125+ if ( webpackConfig . optimization . splitChunks . cacheGroups . common ) {
126+ webpackConfig . optimization . splitChunks . cacheGroups . common . chunks = omitUserScripts
127+ }
124128 }
125129 } )
126130}
You can’t perform that action at this time.
0 commit comments