- 修复 build script 引用已删除的 registerCheckers,恢复生产构建 - 生产入口添加 SIGINT/SIGTERM 优雅关闭(与 dev.ts 一致) - 新增 runtime.retention 配置(默认 7d),ProbeStore.prune() 定时清理过期数据 - parseDuration 扩展支持 h/d 单位 - 新增前端 ErrorBoundary 组件,防止渲染错误白屏 - Vite codeSplitting.groups 拆分 vendor chunks(业务代码 1180KB → 47KB) - 同步 delta specs 到主规范
37 lines
900 B
TypeScript
37 lines
900 B
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
|
|
const backendPort = Number(process.env["BACKEND_PORT"] ?? process.env["PORT"] ?? 3000);
|
|
|
|
export default defineConfig({
|
|
build: {
|
|
assetsDir: "assets",
|
|
emptyOutDir: true,
|
|
outDir: "../../dist/web",
|
|
rolldownOptions: {
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{ name: "vendor-react", test: /node_modules\/(react|react-dom|scheduler)/ },
|
|
{ name: "vendor-tdesign", test: /node_modules\/tdesign/ },
|
|
{ name: "vendor-chart", test: /node_modules\/(recharts|d3-)/ },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
plugins: [react()],
|
|
root: "src/web",
|
|
server: {
|
|
host: "127.0.0.1",
|
|
port: 5173,
|
|
proxy: {
|
|
"/api": {
|
|
changeOrigin: true,
|
|
target: `http://127.0.0.1:${backendPort}`,
|
|
},
|
|
},
|
|
strictPort: true,
|
|
},
|
|
});
|