fix(ui): pre-bundle echarts subpaths to stop dev-server 504 re-optimization

This commit is contained in:
matevip 2026-05-17 21:15:15 +08:00
parent b3e8d1e283
commit 7b053052d7

View File

@ -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: {