This commit is contained in:
2026-09-29 17:56:05 +08:00
parent ef5c8250c5
commit 0aaf855ce2
13 changed files with 121 additions and 145 deletions
+2 -9
View File
@@ -25,9 +25,7 @@ function loggedProxy(name, options) {
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const domesticTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
const overseasTarget = env.OVERSEAS_API_PROXY_TARGET || 'http://127.0.0.1:9300'
const preserveOverseasPrefix = env.OVERSEAS_API_PROXY_PRESERVE_PREFIX === 'true'
const apiTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
return {
plugins: [uni()],
define: {
@@ -38,12 +36,7 @@ export default defineConfig(({ mode }) => {
},
server: {
proxy: {
'/api': loggedProxy('auth', { target: domesticTarget, changeOrigin: true }),
'/overseas-api': loggedProxy('overseas', {
target: overseasTarget,
changeOrigin: true,
rewrite: (path) => preserveOverseasPrefix ? path : path.replace(/^\/overseas-api/, '/api')
})
'/api': loggedProxy('api', { target: apiTarget, changeOrigin: true })
}
},
css: {