var config = {
entry: {
'index':['./src/page/index/index.js'],
'login':['./src/page/login/index.js'],
},
output: {
path:'/Users/liuhaiyuan/mmall/doc/mmall-fe/dist/',
filename: 'js/[name].js'
},
externals : {
'jquery' : 'window.jQuery'
},
plugins: [
],
optimization: {
splitChunks: {
chunks:"all",
cacheGroups: {
commons: { // split `common`和`components`目录下被打包的代码到`page/commons.js && .css`
test: /page\//,
name: 'js/commons',
priority: 10,
enforce: true
}
}
}
}
};
答案不一定对 仅供参考不过我算是将commons.js搞出来了