diff --git a/frontend/web/.env b/frontend/web/.env index d0640cb..33374ce 100644 --- a/frontend/web/.env +++ b/frontend/web/.env @@ -1,4 +1,4 @@ -VITE_API_BASE_URL = http://localhost:5202/api -VITE_SIGNALR_BASE_URL = http://localhost:5202/chat -#VITE_API_BASE_URL = http://192.168.5.116:7070/api -#VITE_SIGNALR_BASE_URL = http://192.168.5.116:7070/chat \ No newline at end of file +#VITE_API_BASE_URL = http://localhost:5202/api +#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat +VITE_API_BASE_URL = https://im.test.nxsir.cn/api +VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat \ No newline at end of file diff --git a/frontend/web/vite.config.js b/frontend/web/vite.config.js index e47930e..5699bc0 100644 --- a/frontend/web/vite.config.js +++ b/frontend/web/vite.config.js @@ -4,9 +4,20 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueDevTools from 'vite-plugin-vue-devtools' + // https://vite.dev/config/ -export default defineConfig({ - base: './', +export default defineConfig(( { command } ) => { + let branch = process.env.BRANCH || 'main' + + // 1️⃣ dev 模式:永远 / + if (command === 'serve') { + branch = '/' + }else{ + branch = `/${branch}/` + } + + return { + base: branch, build: { sourcemap: true }, @@ -19,4 +30,5 @@ export default defineConfig({ '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, +} })