-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
48 lines (48 loc) · 1.21 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
module.exports = {
configureWebpack: {
resolve: {
alias: {
assets: "@/assets",
common: "@/common",
components: "@/components",
network: "@/network",
views: "@/views",
plugins: "@/plugins"
}
}
},
// 公共路径1
publicPath: "./",
// 输出文件目录
outputDir: "dist",
// 静态资源存放的文件夹(相对于ouputDir)
assetsDir: "assets",
lintOnSave: false,
// 我用的only,打包后小些
// compiler: false,
productionSourceMap: true, // 不需要生产环境的设置false可以减小dist文件大小,加速构建
// css相关配置
css: {
loaderOptions: {
sass: {
prependData: `@import "@/assets/scss/_variable.scss";`
}
}
},
// webpack-dev-server 相关配置
devServer: {
open: false, // npm run serve后自动打开页面
host: "0.0.0.0", // 匹配本机IP地址(默认是0.0.0.0)
port: 7758, // 开发服务器运行端口号
proxy: {
"/api": {
target: "https://xx.com/", //要访问的
changeOrigin: true,
ws: true,
pathRewrite: {
"^/api": ""
}
}
}
}
};