-
Notifications
You must be signed in to change notification settings - Fork 25
/
vue.config.js
42 lines (35 loc) · 1.15 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
const path = require('path')
// 拼接路径
function resolve(dir) {
return path.join(__dirname, dir)
}
const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);
module.exports = {
lintOnSave: false,
// productionSourceMap: !IS_PROD, // 生产环境的 source map
chainWebpack: config => {
config.resolve.alias.set('@', resolve('src'))
},
configureWebpack: (config) => {
if (process.env.NODE_ENV == 'production') {
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
}
config["performance"] = {
hints: "warning", // 枚举
// 生成文件的最大体积 整数类型(以字节为单位 300k)
maxAssetSize: 15000000,
// 入口起点的最大体积 整数类型(以字节为单位)
maxEntrypointSize: 15000000,
// 只给出 css js 文件的性能提示
assetFilter: function(assetFilename) {
return assetFilename.endsWith('.css') || assetFilename.endsWith('.js');
}
}
config["externals"] = IS_PROD ? {
'vue': 'Vue',
'vuex': 'Vuex',
"element-ui": "ELEMENT",
'echarts': 'echarts',
} : {}
}
}