fix: align h5 dev proxy with server port
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user