- vite.config.ts: use loadEnv() to read VITE_BASE (base path) and DEV_API_TARGET (proxy target) from .env; falls back to '/' and http://127.0.0.1:3201 so local dev is unchanged - App.tsx: pass basename={import.meta.env.BASE_URL} to BrowserRouter so router paths align with the Vite base at runtime - global.css: change #root overflow from hidden to auto so page content is scrollable - .env: document VITE_BASE, VITE_API_BASE, DEV_API_TARGET defaults - src/config.ts: expose apiBase helper for runtime API prefix - tsconfig.json: add vite/client types so import.meta.env is typed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
13 lines
568 B
Bash
13 lines
568 B
Bash
# Base path for the app (must match Vite `base` and BrowserRouter `basename`).
|
|
# Override in CI/deployment for subpath hosting, e.g. VITE_BASE=/h5/
|
|
VITE_BASE=/
|
|
|
|
# API base URL exposed to the browser bundle.
|
|
# Empty string means API calls are relative (Vite dev proxy handles /v1 → 3201).
|
|
# 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
|