|
@@ -116,36 +116,42 @@ module.exports = {
|
|
|
.optimization.splitChunks({
|
|
|
chunks: 'all',
|
|
|
cacheGroups: {
|
|
|
+ styles: {
|
|
|
+ name: 'styles',
|
|
|
+ test: /\.css$/,
|
|
|
+ chunks: 'all',
|
|
|
+ enforce: true // 忽略splitChunks的其他配置,强制将匹配到的缓存组中的文件合并为一个styles.css文件
|
|
|
+ },
|
|
|
libs: {
|
|
|
name: 'chunk-libs',
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
priority: -10,
|
|
|
chunks: 'initial' // only package third parties that are initially dependent
|
|
|
- },
|
|
|
- elementUI: {
|
|
|
- name: 'chunk-elementUI', // split elementUI into a single package
|
|
|
- priority: 15, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
|
|
- test: /[\\/]node_modules[\\/]element-ui[\\/]/, // in order to adapt to cnpm
|
|
|
- chunks: 'all',
|
|
|
- reuseExistingChunk: true,
|
|
|
- enforce: true
|
|
|
- },
|
|
|
- echarts: {
|
|
|
- name: 'chunk-echarts',
|
|
|
- test: /[\\/]node_modules[\\/]echarts[\\/]/,
|
|
|
- chunks: 'all',
|
|
|
- priority: 10,
|
|
|
- reuseExistingChunk: true,
|
|
|
- enforce: true
|
|
|
- },
|
|
|
- demo: {
|
|
|
- name: 'chunk-demo',
|
|
|
- test: /[\\/]src[\\/]views[\\/]/,
|
|
|
- chunks: 'all',
|
|
|
- priority: 20,
|
|
|
- reuseExistingChunk: true,
|
|
|
- enforce: true
|
|
|
}
|
|
|
+ // elementUI: {
|
|
|
+ // name: 'chunk-elementUI', // split elementUI into a single package
|
|
|
+ // priority: 15, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
|
|
+ // test: /[\\/]node_modules[\\/]element-ui[\\/]/, // in order to adapt to cnpm
|
|
|
+ // chunks: 'all',
|
|
|
+ // reuseExistingChunk: true,
|
|
|
+ // enforce: true
|
|
|
+ // },
|
|
|
+ // echarts: {
|
|
|
+ // name: 'chunk-echarts',
|
|
|
+ // test: /[\\/]node_modules[\\/]echarts[\\/]/,
|
|
|
+ // chunks: 'all',
|
|
|
+ // priority: 10,
|
|
|
+ // reuseExistingChunk: true,
|
|
|
+ // enforce: true
|
|
|
+ // },
|
|
|
+ // demo: {
|
|
|
+ // name: 'chunk-demo',
|
|
|
+ // test: /[\\/]src[\\/]views[\\/]/,
|
|
|
+ // chunks: 'all',
|
|
|
+ // priority: 20,
|
|
|
+ // reuseExistingChunk: true,
|
|
|
+ // enforce: true
|
|
|
+ // }
|
|
|
}
|
|
|
})
|
|
|
config.optimization.runtimeChunk('single')
|