if (process.env.NODE_ENV === 'production') {
config.optimization.splitChunks({
chunks: 'all',
maxInitialRequests: 3,
maxAsyncRequests: 5,
minSize: 30000,
automaticNameDelimiter: '~',
name: true,
cacheGroups: {
vendor: {
chunks: 'all',
test: /node_modules/,
name: 'vendor',
minChunks: 2,
priority: 10
},
echarts: {
name: 'echarts',
test: /[\\/]node_modules[\\/](echarts)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
elementUI: {
name: 'elementUI',
test: /[\\/]node_modules[\\/](element-ui)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
femessageElementUI: {
name: 'femessageElementUI',
test: /[\\/]node_modules[\\/](@femessage)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
momentJs: {
name: 'momentJs',
test: /[\\/]node_modules[\\/](moment)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
luckyExcel: {
name: 'luckyExcel',
test: /[\\/]node_modules[\\/](luckyexcel)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
xlsx: {
name: 'xlsx',
test: /[\\/]node_modules[\\/](xlsx)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
mathJs: {
name: 'mathJs',
test: /[\\/]node_modules[\\/](mathjs)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
vxeTable: {
name: 'vxeTable',
test: /[\\/]node_modules[\\/](vxe-table)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
},
iconSvg: {
name: 'iconSvg',
test: /[\\/]src[\\/](icons)[\\/]/,
chunks: 'all',
enforce: true,
priority: 30
}
}
})
}