-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
113 lines (104 loc) · 2.84 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
103
104
105
106
107
108
109
110
111
112
113
const fs = require("fs");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
let utils = require("./scripts/utils");
let version = utils.generateOnlineVersion();
Object.defineProperty(Date.prototype, "YYYYMMDDHHMMSS", {
value: function () {
function timeDir(n) {
return (n < 10 ? "0" : "") + n;
}
return (
this.getFullYear() +
timeDir(this.getMonth() + 1) +
timeDir(this.getDate()) +
timeDir(this.getHours()) +
timeDir(this.getMinutes()) +
timeDir(this.getSeconds())
);
},
});
var dateDir = new Date().YYYYMMDDHHMMSS();
module.exports = {
publicPath:
process.env.NODE_ENV === "production"
? "xxxx.static.com/" + version + '"/"'
: "",
// outputDir: 在npm run build时 生成文件的目录 type:string, default:'dist'
outputDir: "dist",
// 静态资源存放的位置
assetsDir: "v" + dateDir,
//lintOnSave:{ type:Boolean default:true } 问你是否使用eslint
lintOnSave: true,
// 如果您不需要生产时的源映射,那么将此设置为false可以加速生产构建
productionSourceMap: false,
// devServer:{type:Object} 3个属性host,port,https
devServer: {
port: 7070, // 端口号
host: "xxx.dev.console.com",
https: false, // https:{type:Boolean}
open: true, //配置自动启动浏览器
proxy: {
"/i/xxx": {
target: "http://xxx.dev.api.com/",
changeOrigin: true,
secure: false,
},
},
},
// // 配置插件
configureWebpack: {
resolve: {
alias: {
kpc: "kpc/@stylus",
intact$: "intact-vue",
},
},
module: {
rules: [
{
test: /\.styl$/,
use: [
{
loader: "stylus-loader",
options: {
"include css": true,
"resolve url": true,
import: "~kpc/styles/themes/ksyun/index.styl",
},
},
],
},
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
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.resolve.alias.set('@b', path.resolve('./src'))
},
lintOnSave: false,
};