From e666aff9eb718af020d17718debf10e7caf2679e Mon Sep 17 00:00:00 2001 From: Xwen <929716663@qq.com> Date: Thu, 4 Jan 2024 21:46:19 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E6=B7=BB=E5=8A=A0ws=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Bbs.Vue3/.env.development | 6 +++++- Yi.Bbs.Vue3/.env.production | 5 ++++- Yi.Bbs.Vue3/vite.config.js | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Yi.Bbs.Vue3/.env.development b/Yi.Bbs.Vue3/.env.development index 41b3bb9e..18bc139b 100644 --- a/Yi.Bbs.Vue3/.env.development +++ b/Yi.Bbs.Vue3/.env.development @@ -3,5 +3,9 @@ VITE_APP_BASEAPI="/api-dev" VITE_APP_URL="http://123.207.63.87:19001/api/app" # VITE_APP_URL="http://localhost:19001/api/app" VITE_APP_ENV_NAME = "dev" + # ws/开发环境 -VITE_APP_BASE_WS = '/dev-ws' \ No newline at end of file +VITE_APP_BASE_WS = '/dev-ws' + +#长连接 +VITE_APP_BASE_URL_WS='http://localhost:19001/hub' \ No newline at end of file diff --git a/Yi.Bbs.Vue3/.env.production b/Yi.Bbs.Vue3/.env.production index bd11868b..f8be2a0f 100644 --- a/Yi.Bbs.Vue3/.env.production +++ b/Yi.Bbs.Vue3/.env.production @@ -2,5 +2,8 @@ VITE_APP_BASEAPI="/prod-api" VITE_APP_URL="http://123.207.63.87:19001/api/app" VITE_APP_ENV_NAME = "pro" + # ws/开发环境 -VITE_APP_BASE_WS = '/dev-ws' \ No newline at end of file +VITE_APP_BASE_WS = '/dev-ws' +#长连接 +VITE_APP_BASE_URL_WS='http://localhost:19001/hub' \ No newline at end of file diff --git a/Yi.Bbs.Vue3/vite.config.js b/Yi.Bbs.Vue3/vite.config.js index f37467ae..a4996fbe 100644 --- a/Yi.Bbs.Vue3/vite.config.js +++ b/Yi.Bbs.Vue3/vite.config.js @@ -35,6 +35,12 @@ export default defineConfig(({ command, mode }) => { changeOrigin: true, rewrite: (path) => path.replace(/^\/api-dev/, ""), }, + [env.VITE_APP_BASE_WS]: { + target: env.VITE_APP_BASE_URL_WS, + changeOrigin: true, + rewrite: (p) => p.replace(/^\/dev-ws/, ""), + ws: true, + }, }, }, // 增加新的配置