-
Notifications
You must be signed in to change notification settings - Fork 10
/
vue.config.js
77 lines (76 loc) · 2.58 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
module.exports = {
pages: {
index: {
entry: 'src/editor/main.js',
template: 'public/index.html',
title: '爱前端H5可视化编辑',
chunks: ['index', 'chunk-vendors', 'chunk-common', 'chunk-element-ui']
},
preview: {
entry: 'src/preview/main.js',
template: 'public/preview.html',
title: '爱前端H5预览页',
chunks: ['preview', 'chunk-vendors', 'chunk-common']
},
screenshot: {
entry: 'src/screenshot/main.js',
template: 'public/screenshot.html',
title: '爱前端H5截屏页',
chunks: ['screenshot', 'chunk-vendors', 'chunk-common']
}
},
publicPath: process.env.NODE_ENV === "production" ? "/yee/" : "/",
devServer: {
port: 8080,
host: "0.0.0.0",
proxy: process.env.VUE_APP_DOMAIN
},
productionSourceMap: false,
parallel: true,
css: {
// 是否提取css 生产环境可以配置为 true
extract: process.env.NODE_ENV === "production"
},
chainWebpack: config => {
if (process.env.NODE_ENV === "production") {
// 删除系统默认的splitChunk
config.optimization.delete("splitChunks");
}
},
configureWebpack: config => {
config.output.filename = "[name].[hash].js";
config.output.chunkFilename = "[name].[hash].js";
config.optimization = {
splitChunks: {
cacheGroups: {
common: {
name: "chunk-common",
chunks: "initial",
minChunks: 2,
maxInitialRequests: 5,
minSize: 0,
priority: 1,
reuseExistingChunk: true,
enforce: true
},
vendors: {
name: "chunk-vendors",
test: /[\\/]node_modules[\\/]/,
chunks: "initial",
priority: 2,
reuseExistingChunk: true,
enforce: true
},
element: {
name: "chunk-element-ui",
test: /[\\/]node_modules[\\/]element-ui[\\/]/,
chunks: "all",
priority: 3,
reuseExistingChunk: true,
enforce: true
}
}
}
}
}
}