unis_manager/web/vite.config.ts

18 lines
700 B
TypeScript
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
// 生产构建产物 web/dist 由 FastAPI 直接托管(app/main.py 的 WEB_DIR);
// 本地想改样式不打包时,跑 npm run dev(5174),/api 代理到后端 5173。
export default defineConfig({
// 产物由 FastAPI 挂在 /static 下(app/main.py),所以资源前缀必须是 /static/
base: "/static/",
plugins: [react(), tailwindcss()],
build: { outDir: "dist", emptyOutDir: true, target: "es2022" },
server: {
port: 5174,
strictPort: true,
proxy: { "/api": "http://127.0.0.1:5173", "/health": "http://127.0.0.1:5173" },
},
});