-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
37 lines (36 loc) · 1.05 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
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath:
process.env.NODE_ENV === 'production'
? process.env.VUE_APP_NGINX_PATH
: '/',
lintOnSave: false,
devServer: {
open: true,
host: 'localhost',
port: 8080
},
configureWebpack: {
devServer: {
proxy: {
[process.env.VUE_APP_BASE_API]: {
//捕获API的标志,如果API中有这个字符串,那么就开始匹配代理,
target: process.env.VUE_APP_BASE_DEV_SERVER_PROXY_TARGET, //代理的api地址,就是要跨域的地址
changeOrigin: true, // 这个参数可以让target参数是域名
// ws: true, //是否启用websockets,用不到可设为false
pathRewrite: {
//对路径匹配到的字符串重写
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
}
}
},
chainWebpack: config => {
config.plugin('html').tap(args => {
args[0].title = 'odoojs'
return args
})
}
})