From fa76777aa8b92be80fa8ce12d086a1989d017811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Sun, 7 May 2023 21:07:51 +0800 Subject: [PATCH] =?UTF-8?q?docs(vite.config.ts):=20:memo:=20=E5=8F=8D?= =?UTF-8?q?=E5=90=91=E4=BB=A3=E7=90=86=E8=A7=A3=E5=86=B3=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: dc1a27b761d1a72fcdf7396793ca7ce2b515f045 --- vite.config.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index ce716feb..e708a8d2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -40,17 +40,14 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { host: "0.0.0.0", port: Number(env.VITE_APP_PORT), open: true, // 运行是否自动打开浏览器 - // 反向代理解决跨域 proxy: { + // 反向代理解决跨域 [env.VITE_APP_BASE_API]: { - // 线上接口API地址 - target: "http://vapi.youlai.tech", - // 本地接口API地址 - // target: 'http://localhost:8989', + target: "http://vapi.youlai.tech", // 线上接口地址 + // target: 'http://localhost:8989', // 本地接口地址 , 后端工程仓库地址:https://gitee.com/youlaiorg/youlai-boot changeOrigin: true, rewrite: (path) => - // localhost:3000/dev-api/users/me → http://vapi.youlai.tech/users/me - path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), + path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), // 替换 /dev-api 为 target 接口地址 }, }, },