-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvue.config.js
56 lines (52 loc) · 1.42 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
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
const devServerPort = 8112
const name = 'Pandora'
const publicPath = IS_PROD ? '/vue-pandora' : '/'
module.exports = {
publicPath: publicPath,
lintOnSave: false,
outputDir: 'lib',
productionSourceMap: false,
devServer: {
port: devServerPort,
open: false,
overlay: {
warnings: false,
errors: true
},
proxy: false
},
css: {
// extract: false,
requireModuleExtension: true,
loaderOptions: {
css: {
modules: {
localIdentName: '[name]_[hash:base64:8]'
},
localsConvention: 'camelCaseOnly'
}
}
},
chainWebpack(config) {
// it can be accessed in index.html to inject the correct title.
config.set('name', name)
// https://webpack.js.org/configuration/devtool/#development
config.when(!IS_PROD, config => config.devtool('cheap-eval-source-map'))
if (IS_PROD) {
config.optimization.minimizer('terser').tap(args => {
Object.assign(args[0].terserOptions.compress, {
// 生产模式 console.log 去除
// warnings: false , // 默认 false
// drop_console: ,
drop_console: true,
drop_debugger: true, // 默认也是true
pure_funcs: ['console.log']
})
return args
})
}
// remove vue-cli-service's progress output
config.plugins.delete('progress')
}
}