1
This commit is contained in:
@@ -9,7 +9,10 @@ const CompressionPlugin = require('compression-webpack-plugin')
|
||||
|
||||
const name = process.env.VUE_APP_TITLE || 'Jarvis' // 网页标题
|
||||
|
||||
// 后端接口地址(仅用于开发环境代理)
|
||||
const baseUrl = process.env.VUE_APP_BASE_API || 'http://127.0.0.1:30313' // 后端接口
|
||||
// 开发环境代理路径(如果未设置VUE_APP_BASE_API,使用默认代理路径)
|
||||
const devApiPath = process.env.VUE_APP_BASE_API || '/dev-api'
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
@@ -35,16 +38,18 @@ module.exports = {
|
||||
open: true,
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: baseUrl,
|
||||
// 如果VUE_APP_BASE_API是相对路径(如/dev-api),则使用代理
|
||||
// 如果是绝对URL,则直接使用该URL,不配置代理
|
||||
[devApiPath]: {
|
||||
target: baseUrl.startsWith('http') ? baseUrl : 'http://127.0.0.1:30313',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
['^' + devApiPath]: ''
|
||||
}
|
||||
},
|
||||
// springdoc proxy
|
||||
'^/v3/api-docs/(.*)': {
|
||||
target: baseUrl,
|
||||
target: baseUrl.startsWith('http') ? baseUrl : 'http://127.0.0.1:30313',
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user