Files
chat_app/frontend/README.md
2025-12-06 16:03:18 +08:00

44 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# React + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
## 环境变量配置
本项目使用环境变量来配置 API 基础地址。
### 配置说明
1. 复制 `.env.example` 文件为 `.env`:
```bash
cp .env.example .env
```
2. 编辑 `.env` 文件,设置您的 API 基础地址:
```env
VITE_API_BASE_URL=http://your-api-server.com/api
```
3. 环境变量以 `VITE_` 开头才能在客户端代码中访问
### 可用环境变量
- `VITE_API_BASE_URL`: API 服务器的基础地址
### 开发说明
- 环境变量在开发服务器重启后生效
- 生产环境部署时,请确保正确设置环境变量