From 7b053052d7571201cfc64b44d2c4fdf52b5763e0 Mon Sep 17 00:00:00 2001 From: matevip Date: Sun, 17 May 2026 21:15:15 +0800 Subject: [PATCH] fix(ui): pre-bundle echarts subpaths to stop dev-server 504 re-optimization --- mateclaw-ui/vite.config.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mateclaw-ui/vite.config.ts b/mateclaw-ui/vite.config.ts index fb43f3e7..063575b4 100644 --- a/mateclaw-ui/vite.config.ts +++ b/mateclaw-ui/vite.config.ts @@ -33,6 +33,20 @@ export default defineConfig({ '@': resolve(__dirname, 'src'), }, }, + // echarts is consumed via subpath modules (echarts/core, echarts/charts, …) + // that only the route-lazy Dashboard and Wiki graph views import. Vite's + // startup dep scan never sees these subpaths, so it re-optimizes the first + // time either route loads — rolling the optimized-deps hash and 504-ing the + // chunks the in-flight page already referenced. Pre-listing them forces a + // single consistent pre-bundle at server startup. + optimizeDeps: { + include: [ + 'echarts/core', + 'echarts/charts', + 'echarts/components', + 'echarts/renderers', + ], + }, server: { port: 5173, proxy: {