-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
38 lines (37 loc) · 1.32 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
const path = require('path');
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: false,
overlay: {
warnings: true,
errors: true
},
proxy: { // 服务器代理相关
'/api': {
target: 'http://t.yushu.im', // 如果使用代理,配置代理的数据库地址
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'),
}
}
}
}