-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
40 lines (36 loc) · 957 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
37
38
39
40
const fs = require('fs')
const isProd = process.env.NODE_ENV === 'production'
const TerserPlugin = require('terser-webpack-plugin')
const devServer = () =>
!isProd &&
'LOCALHOST_SSL_KEY' in process.env &&
'LOCALHOST_SSL_CRT' in process.env &&
fs.existsSync(process.env.LOCALHOST_SSL_KEY) &&
fs.existsSync(process.env.LOCALHOST_SSL_CRT)
? {
host: 'localhost',
https: {
key: fs.readFileSync(process.env.LOCALHOST_SSL_KEY),
cert: fs.readFileSync(process.env.LOCALHOST_SSL_CRT)
}
}
: ''
module.exports = {
...(devServer() && { devServer: devServer() }),
publicPath: isProd ? './' : '/',
configureWebpack: {
devtool: isProd ? 'none' : 'source-map',
optimization: {
minimize: isProd,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true
}
}
})
]
}
}
}