26feb3d2777f388c37193ea83352ccf984a6ca9d
- #2 JWT HttpOnly Cookie: authSlice/LoginModalContext 不再向 localStorage 写入 access/refresh/token_type (仅存非敏感 user), 登出/401 时调用 POST /user/logout/ 清服务端 Cookie; axios withCredentials=true, 401 无 token 也走 /user/token/refresh/ 空载荷刷新(单飞); WS createWebSocket token 参数可省略由 Cookie 鉴权; Navbar/MobileTopNav/Chat/ChatMobile/Bug/ useRecordHistory 的 localStorage access_token 判断改走登录态 - P2 #10 死依赖清理: 移除 @chakra-ui/react @emotion/react next-themes zustand react-lorem-ipsum react-syntax-highlighter qrcode.react @types/qrcode; 删 components/ui 整目录与 Markdown/Markdown.tsx; 删 package-lock.json yarn.lock 仅留 pnpm-lock; untrack tsconfig.tsbuildinfo - Dockerfile: 弃用 npm install, 改 corepack pnpm@9 --frozen-lockfile - nginx.conf: API 白名单补 air-quality/weather/currency/shorturl, 补 /swagger.json 反代
React + TypeScript + 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 uses Oxc
- @vitejs/plugin-react-swc uses SWC
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.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
Languages
TypeScript
57.5%
CSS
33.1%
JavaScript
6%
HTML
2.8%
Python
0.6%