1c3f8b39a3
Co-authored-by: gin <gin-18@qq.com> Co-authored-by: gin <dengxinmin@owlscm.com> Reviewed-on: #1
64 lines
1.3 KiB
Markdown
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`.
|