-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
102 lines (96 loc) · 3.37 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
let utils = require('./scripts/utils');
let version = utils.generateOnlineVersion();
module.exports = {
publicPath: '',
// process.env.NODE_ENV === 'production'
// ? 'xxxx.static.com/' + version + '"/"'
// : '',
// outputDir: 在npm run build时 生成文件的目录 type:string, default:'dist'
outputDir: 'dist',
// lintOnSave:{ type:Boolean default:true } 问你是否使用eslint
lintOnSave: true,
// 如果您不需要生产时的源映射,那么将此设置为false可以加速生产构建
productionSourceMap: false,
// devServer:{type:Object} 3个属性host,port,https
devServer: {
port: 8080, // 端口号
host: 'localhost',
https: false, // https:{type:Boolean}
open: true, // 配置自动启动浏览器
proxy: {
'/i/xxx': {
target: 'http://xxx.dev.api.com/',
changeOrigin: true,
secure: false
}
}
},
// // 配置插件
configureWebpack: {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
kpc: 'kpc-vue/@stylus'
}
},
module: {
rules: [
{
test: /\.styl$/,
use: [
{
loader: 'stylus-loader',
options: {
'include css': true,
'resolve url': true,
import: '~kpc/styles/themes/ksyun/index.styl'
}
}
]
}
]
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
extractComments: false,
terserOptions: {
format: {
comments: false
}
}
})
// new UglifyJsPlugin({
// uglifyOptions: {
// warnings: false,
// compress: {
// drop_console: true, // console
// drop_debugger: false,
// pure_funcs: ['console.log'] // 移除console
// }
// }
// })
// new HtmlWebpackPlugin({
// // 构建html文件
// filename: './index.html',
// template: './src/template/index.html',
// // inject: false,
// minify: {
// // 压缩HTML文件
// removeComments: true, // 移除html中的注释
// collapseWhitespace: false // 删除空白符与换行符
// }
// })
]
}
},
chainWebpack: (config) => {
// config.resolve.alias.set('@b', path.resolve('./src'))
config.resolve.alias.set('kpc-vue', 'kpc-vue/@stylus');
}
};