AgentEvalTool/frontend/web/vite.config.ts
sinohqb 9c564b575e feat(frontend): v0.4 login page, dashboard rebuild, reports UX, keep-alive refresh
- 登录页 + App 鉴权门 + X-Auth-Token 拦截器 + 菜单头部退出按钮
- 仪表盘重构:6 指标卡 / 趋势图 + 场景表现 / 最近记录 + 快捷操作 + 来源分布
- Reports 页重做:场景筛选、富选项下拉、allowClear、一键重置、同场景对比约束
- useOnTabActive:标签页激活自动刷新(根治 AI 助手评测记录"消失")
- ModelConfigs 12 列合并为 6 列;来源 Tag;chunk 告警阈值修正并记录原因
2026-07-28 17:41:08 +08:00

57 lines
2.0 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
'/ws': {
target: 'ws://localhost:8000',
ws: true,
},
'/openclaw': {
target: 'http://localhost:8000',
changeOrigin: true,
ws: true,
},
},
},
build: {
// Accepted oversized chunks (measured 2026-07-28):
// vendor ~2.12 MB min / ~650 kB gzip — react + @ant-design/charts
// (charts CANNOT be split out: forced separate chunk creates
// a circular reference and a runtime TDZ crash, and charts
// loads on the default Home route anyway)
// vendor-antd ~620 kB min / ~173 kB gzip
// Warning fires only above this limit, i.e. on a real size regression.
chunkSizeWarningLimit: 2200,
rollupOptions: {
output: {
manualChunks(id) {
// Monaco Editor — only used by Scenarios page, cleanly isolated.
if (id.includes('@monaco-editor') || id.includes('monaco-editor')) {
return 'vendor-monaco'
}
// Ant Design core — used everywhere, one-way deps (no circular chunk).
if (id.includes('antd') || id.includes('@ant-design/icons')) {
return 'vendor-antd'
}
// Everything else (React, @ant-design/charts + @antv/*, etc.) → vendor.
// NOTE: do NOT split @ant-design/charts into its own chunk — its deep
// @antv dependency graph creates a circular chunk reference that causes
// a runtime TDZ crash ("Cannot access 'd' before initialization").
// Returning undefined for @antv doesn't help either: rollup still
// merges it into vendor (verified 2026-07-28).
if (id.includes('node_modules')) {
return 'vendor'
}
},
},
},
},
})