From a6551f61a1382a478c49983d4c08df92c898b2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Thu, 29 Sep 2022 21:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E4=BB=A3=E7=90=86=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=94=B9=E7=94=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + vite.config.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.env.development b/.env.development index 7346fda..488868c 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,7 @@ # 开发环境配置 ENV = 'development' +VITE_APP_API_HOST = 'http://localhost:8888' # 开发环境 VITE_APP_BASE_API = '/dev-api' diff --git a/vite.config.js b/vite.config.js index 886afcd..56feffb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -51,12 +51,12 @@ export default defineConfig(({ mode, command }) => { proxy: { // https://cn.vitejs.dev/config/#server-proxy '/dev-api': { - target: 'http://localhost:8888', + target: env.VITE_APP_API_HOST, changeOrigin: true, rewrite: (path) => path.replace(/^\/dev-api/, '') }, '/msghub': { - target: 'http://localhost:8888', + target: env.VITE_APP_API_HOST, ws: true, rewrite: (path) => path.replace(/^\/msgHub/, '') }