-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
48 lines (48 loc) · 1.33 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 path = require("path");
const resolve = function(dir) {
return path.join(__dirname, dir);
};
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "./" : "./",
outputDir: "dist",
assetsDir: "static",
lintOnSave: true, // 是否开启eslint保存检测
productionSourceMap: false, // 是否在构建生产包时生成sourcdeMap
chainWebpack: config => {
config.resolve.alias
.set("@", resolve("src"))
.set("@v", resolve("src/views"))
.set("@c", resolve("src/components"))
.set("@u", resolve("src/utils"))
.set("@s", resolve("src/service")); /* 别名配置 */
config.optimization.runtimeChunk("single");
},
devServer: {
host: "localhost",
/* 本地ip地址 */
// host: "192.168.1.109",
host: "0.0.0.0", //局域网和本地访问
port: "8080",
hot: true,
/* 自动打开浏览器 */
open: false,
overlay: {
warning: false,
error: true
},
/* 跨域代理 */
proxy: {
"/api": {
/* 目标代理服务器地址 */
target:
"https://www.fastmock.site/mock/8d1cd4026afe8d2c2b2af85fdd719ab2/admin",
/* 允许跨域 */
changeOrigin: true,
ws: true,
pathRewrite: {
"^/api": ""
}
}
}
}
};