-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
vue.config.js
36 lines (36 loc) · 919 Bytes
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module.exports = {
publicPath: '',
productionSourceMap: false,
pages: {
index: {
entry: 'src/pages/index/main.js',
chunks: ['chunk-common', 'chunk-index-vendors', 'index'],
},
live: {
entry: 'src/pages/live/main.js',
chunks: ['chunk-common', 'chunk-live-vendors', 'live'],
},
},
chainWebpack: config => {
const pageKeys = Object.keys(module.exports.pages);
config.optimization.splitChunks({
cacheGroups: {
...pageKeys.map(key => ({
name: `chunk-${key}-vendors`,
priority: -10,
chunks: chunk => chunk.name === key,
test: /[\\/]node_modules[\\/]/,
enforce: true,
})),
common: {
name: 'chunk-common',
priority: 0,
chunks: 'initial',
minChunks: 2,
reuseExistingChunk: true,
enforce: true,
},
},
});
},
};