From 91974178399ff1618e992e0a9f609ac99463bfc1 Mon Sep 17 00:00:00 2001 From: jesxion Date: Tue, 28 Apr 2026 10:21:49 +0800 Subject: [PATCH] fix: align h5 dev proxy with server port Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 4 ++-- h5-app/.env | 4 ++-- h5-app/vite.config.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f78eb03..0a40a32 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ OSS_REGION=oss-cn-beijing ```dotenv # 开发时 API 代理目标(Vite 代理,不会暴露在浏览器) -DEV_API_TARGET=http://127.0.0.1:3201 +DEV_API_TARGET=http://127.0.0.1:3000 # 生产部署时如需子路径,设置此项,例如 /h5/ VITE_BASE=/ @@ -213,7 +213,7 @@ npm run dev # tsx watch,热重载,默认监听 :3000 # 终端 2:移动端 H5 cd h5-app -npm run dev # Vite dev server,默认 :5173,/v1 代理到 :3201(或 DEV_API_TARGET) +npm run dev # Vite dev server,默认 :5173,/v1 代理到 :3000(或 DEV_API_TARGET) # 终端 3:管理后台 cd admin-web diff --git a/h5-app/.env b/h5-app/.env index c80254d..60c5753 100644 --- a/h5-app/.env +++ b/h5-app/.env @@ -3,10 +3,10 @@ VITE_BASE=/ # API base URL exposed to the browser bundle. -# Empty string means API calls are relative (Vite dev proxy handles /v1 → 3201). +# Empty string means API calls are relative (Vite dev proxy handles /v1 → 3000). # Set to an absolute URL for production deployments, e.g. https://api.example.com VITE_API_BASE= # Proxy target for local dev server (not exposed to browser). # Override with DEV_API_TARGET=http://host:port to point at a different backend. -DEV_API_TARGET=http://127.0.0.1:3201 +DEV_API_TARGET=http://127.0.0.1:3000 diff --git a/h5-app/vite.config.ts b/h5-app/vite.config.ts index 63a2687..e779a05 100644 --- a/h5-app/vite.config.ts +++ b/h5-app/vite.config.ts @@ -6,7 +6,7 @@ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), '') const base = env.VITE_BASE || '/' - const apiTarget = env.DEV_API_TARGET || 'http://127.0.0.1:3201' + const apiTarget = env.DEV_API_TARGET || 'http://127.0.0.1:3000' return { base,