-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
55 lines (54 loc) · 1.57 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
const path = require("path");
const px2rem = require("postcss-px2rem");
const postcss = px2rem({
remUnit: 16 //基准大小 baseSize,需要和rem.js中相同(不做更改)
});
module.exports = {
// 默认输出的路径 就是在当前地址栏后面添加的路径 若为 'ccc' ,则为 http://localhost:8085/ccc/
publicPath: "/",
// 不同的环境打不同包名
outputDir: process.env.NODE_ENV === "development" ? "devdist" : "dist",
lintOnSave: false, // 关闭eslint
productionSourceMap: true, // 生产环境下css 分离文件
devServer: {
// 配置服务器
port: 8086,
open: true,
https: true,
overlay: {
warnings: true,
errors: true
},
proxy: {
// 服务器代理相关
"/api": {
target: "https://api.uuseesee.com", // 如果使用代理,配置代理的数据库地址
changeOrigin: true, // 是否设置同源
pathRewrite: {
// 路径重写
"^/api": "" // 选择忽略拦截器里面的单词
}
}
}
},
configureWebpack: {
// 覆盖webpack默认配置的都在这里
resolve: {
// 配置解析别名其中:@代表根目录,@c代表 src/components 文件夹,等
alias: {
"@": path.resolve(__dirname, "./src"),
"@a": path.resolve(__dirname, "./src/assets"),
"@c": path.resolve(__dirname, "./src/components"),
"@u": path.resolve(__dirname, "./src/utils")
}
}
},
css: {
// 移动端自适应:css 配置
loaderOptions: {
postcss: {
plugins: [postcss]
}
}
}
};