-
Notifications
You must be signed in to change notification settings - Fork 11
/
vue.config.js
65 lines (62 loc) · 1.72 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
/**
* api mocker 反向代理配置
* mocker 平台基于 rap2, 内网地址:http://mock.nixin8.com/
* dev proxy 配置参考: https://cli.vuejs.org/zh/config/#devserver-proxy
*/
// let isUseDevServerProxy = true
// let apiProxyTarget = 'http://mock.nixin8.com/app/mock/19'
// let apiProxyMatches = ['/user', '/api']
// let devProxyOptions = undefined
// if (isUseDevServerProxy) {
// devProxyOptions = {}
// apiProxyMatches.forEach(api => {
// devProxyOptions[api] = {
// target: apiProxyTarget,
// changeOrigin: true,
// pathRewrite: (path, req) => '/' + req.method + '/' + path,
// bypass: function (req, res, proxyOpt) {
// res.set('RAD-PROXY', 'on');
// res.set('RAD-PROXY-BY', apiProxyTarget);
// }
// }
// })
// }
/**
* 基础编译配置。
* 更多配置项,请参考:https://cli.vuejs.org/config/
*/
module.exports = {
lintOnSave: false,
configureWebpack: {
resolve: {
extensions: ['.js', '.json', '.vue'],
// alias: {
// vue: 'vue/dist/vue.js',
// }
},
},
baseUrl: './',
assetsDir: 'static',
devServer: {
port: 8998,
proxy: { // devProxyOptions
'/': {
ws: false, // proxy websockets
target: 'http://mock.nixin8.com/app/mock',
changeOrigin: true,
pathRewrite: (path, req) => {
let c = path.split('projectid=')
if (c.length == 2) {
return '/' + c[1] + '/' + req.method + '/' + c[0]
} else {
return '/' + req.method + '/' + c[0]
}
},
bypass: function(req, res, proxyOpt) {
res.set('RAD-PROXY', 'on');
res.set('RAD-PROXY-BY', 'http://mock.nixin8.com/app/mock');
}
}
}
}
}