-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
48 lines (45 loc) · 1.18 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
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
// const path = require('path')
// const resolve = dir => path.join(__dirname, '.', dir)
module.exports = {
// 修改 src 目录 为 examples 目录
pages: {
index: {
entry: 'examples/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer.push(
new UglifyJsPlugin({
uglifyOptions: {
warnings: false,
compress: {
drop_debugger: true,
drop_console: true
}
},
sourceMap: true,
parallel: true
})
)
}
},
chainWebpack: config => {
config.module
// vue-template-compiler 去掉标签之间的空格
// https://github.com/vuejs/vue-docs-zh-cn/blob/master/vue-template-compiler/README.md#%E9%80%89%E9%A1%B9
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = false
return options
})
config.externals({
vue: 'Vue'
})
}
}