Merge pull request #40 from cshaptx4869/patch-12

build(vite.config.ts): 📦 代理接口地址通过env配置文件修改
This commit is contained in:
Ray Hao authored and GitHub committed 2024-03-01 16:52:24 +08:00
commit 8c12cfecbe
2 files changed
+7 -4

No files matched your search

+5
View File
@@ -6,3 +6,8 @@ VITE_APP_PORT = 3000
# 代理前缀 # 代理前缀
VITE_APP_BASE_API = '/dev-api' VITE_APP_BASE_API = '/dev-api'
# 线上接口地址
VITE_APP_API_URL = http://vapi.youlai.tech
# 开发接口地址
# VITE_APP_API_URL = http://localhost:8989
+2 -4
View File
@@ -51,10 +51,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
*/ */
[env.VITE_APP_BASE_API]: { [env.VITE_APP_BASE_API]: {
changeOrigin: true, changeOrigin: true,
// 线上接口地址 // 接口地址
target: "http://vapi.youlai.tech", target: env.VITE_APP_API_URL,
// 开发接口地址
// target: "http://localhost:8989",
rewrite: (path) => rewrite: (path) =>
path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""),
}, },