我正在尝试在Webpack4中使用splitChunks,希望将node_modules中的模块捆绑成几个捆绑,但是我的代码无法正常工作
optimization:{
splitChunks:{
cacheGroups:{
vendors:{
test:/[\\\/]node_modules[\\\/]vue[\\\/]/,
name:'js/chunk-vendors',
chunks:'initial',
},
ui:{
test:/[\\\/]node_modules[\\\/]element-ui[\\\/]/,
name:'js/chunk-element',
chunks:'initial',
},
basic:{
test:/[\\\/]node_modules[\\\/](vue-router|vuex)[\\\/]/,
name:'js/chunk-basic',
chunks:'initial',
},
common:{
test:/[\\\/]src[\\\/]/,
name:'js/chunk-common',
minChunks:2,
chunks:'initial',
}
}
}
},
仅生成chunk-basic.js
和chunk-element.js
;
我希望将其作为配置输出,该怎么办?