From 9d17e600ed6ba2c9fc773059814d63db28a28db0 Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Wed, 22 Mar 2023 22:19:27 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B3=A8=E9=87=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index fa2fa99..cb61570 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,19 +38,17 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { } } }, - // 本地反向代理解决浏览器跨域限制 server: { host: '0.0.0.0', port: Number(env.VITE_APP_PORT), - open: true, // 运行自动打开浏览器 + open: true, // 运行是否自动打开浏览器 + // 反向代理解决跨域 proxy: { [env.VITE_APP_BASE_API]: { - // 线上API地址 target: 'http://vapi.youlai.tech', - // 本地API地址 - // target: 'http://localhost:8989', 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), '') } }