Files
2026-06-17 20:58:00 +08:00

64 lines
1.3 KiB
Markdown

# Frontend
Frontend packages are managed by the root pnpm workspace.
This directory contains:
- `web`: Vite + Vue 3 admin frontend.
- `app`: Taro + Vue 3 app frontend.
Run commands from the repository root:
```bash
pnpm install
pnpm dev:web
pnpm dev:app:weapp
```
## Environment Files
Frontend environment variables are maintained in each app directory.
### Web
Web env files live in `frontend/web`:
- `.env`: default Vite values.
- `.env.development`: local development values.
- `.env.production`: production build values.
- `.env.staging`: staging build values.
Common variables:
```env
VITE_PORT=8848
VITE_PUBLIC_PATH=./
VITE_ROUTER_HISTORY="hash"
VITE_CDN=false
VITE_COMPRESSION="none"
VITE_APP_BASE_API=/dev-api
```
For Vercel deployment, create a Web project with `frontend/web` as the Root
Directory. Use the Vite framework preset, `pnpm install`, `pnpm build`, and
`dist` as the output directory. Configure `VITE_APP_BASE_API` in Vercel with
the deployed backend URL.
### App
App env files live in `frontend/app`:
- `.env.development`: local development values.
- `.env.production`: production build values.
- `.env.test`: test build values.
Common variables:
```env
TARO_APP_ID=
TARO_APP_API_BASE=
```
When `TARO_APP_API_BASE` is empty, the app HTTP client falls back to
`http://localhost:3000`.