split chunks

This commit is contained in:
Qiuxia Fan 2022-04-11 20:40:21 +08:00
parent 92ebb25fba
commit 128679e0a5

View File

@ -54,16 +54,33 @@ module.exports = {
config.optimization = { config.optimization = {
splitChunks: { splitChunks: {
chunks: "all", chunks: "all",
minSize: 20000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
enforceSizeThreshold: 50000,
cacheGroups: { cacheGroups: {
echarts: { echarts: {
name: "echarts", name: "echarts",
test: /[\\/]node_modules[\\/]echarts[\\/]/, test: /[\\/]node_modules[\\/]echarts|zrender[\\/]/,
priority: 20, priority: 30,
}, },
elementPlus: { elementPlus: {
name: "element-plus", name: "element-plus",
test: /[\\/]node_modules[\\/]element-plus[\\/]/, test: /[\\/]node_modules[\\/]element-plus|@element-plus[\\/]/,
priority: 19, priority: 10,
},
defaultVendors: {
name: "chunk-vendors",
test: /[\\/]node_modules[\\/]/,
priority: -10,
chunks: "async",
},
default: {
name: "chunk-commons",
minSize: 0,
minChunks: 2,
priority: -20,
}, },
}, },
}, },