258bccfad3
- 脚手架:Vite6 + React18 + TypeScript(strict) + Tailwind4 - shadcn/ui 基座(依 design/installation.md):components.json + src/components/ui/* + cn(),radix-ui 单片 - 认证:登录(密码+多身份选择 select-identity),lib/auth.tsx(上下文+localStorage) - RBAC:lib/rbac.tsx 八端口导航过滤 + App.tsx RequireAuth/RoleRoute - 布局:AppShell(侧边栏+顶栏+身份切换+用户菜单) - API:client.ts(fetch+token+401登出) + resources.ts(用户/课程/活动/报名/测评/算力/园区) - 页面:登录/总览 + 用户/课程/活动/报名/测评/算力/园区 7 个管理页(未实现端点优雅降级) - npm run build 通过;.env.example / README.md / .gitignore
29 lines
973 B
TypeScript
29 lines
973 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { fileURLToPath, URL } from "node:url";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const rootDir = fileURLToPath(new URL(".", import.meta.url));
|
|
const env = loadEnv(mode, rootDir, "");
|
|
|
|
return {
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
base: env.VITE_BASE_PATH || "/",
|
|
server: {
|
|
port: 5175,
|
|
proxy: {
|
|
// 开发期把 /api 与 /auth、/admin 代理到 server-core,避免跨域
|
|
"/api": { target: env.VITE_API_PROXY || "http://127.0.0.1:8090", changeOrigin: true },
|
|
"/auth": { target: env.VITE_API_PROXY || "http://127.0.0.1:8090", changeOrigin: true },
|
|
"/admin": { target: env.VITE_API_PROXY || "http://127.0.0.1:8090", changeOrigin: true },
|
|
},
|
|
},
|
|
};
|
|
});
|