From bd166b2f778d1e23f187097932f1b65831f08afb Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Sat, 23 Aug 2025 01:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20perf(vite):=20remove=20visactor?= =?UTF-8?q?=20manual=20chunk=20to=20avoid=20preloading=20on=20Home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Home was unexpectedly loading the `visactor-*.js` bundle on first paint. This happened because the Vite manualChunks entry created a standalone vendor chunk for VisActor, which Vite then preloaded on the initial route. What’s changed - Removed `visactor` from `build.rollupOptions.output.manualChunks` in `web/vite.config.js`. Why - Prevents VisActor from being preloaded on the Home page. - Restores the intended behavior: VisActor loads only when the Dashboard (data analytics) is visited. Impact - Smaller initial payload and fewer network requests on Home. - No functional changes to charts; loading behavior is now route-driven. Test plan - Build the app: `cd web && npm run build`. - Open the preview and visit `/`: ensure no `visactor-*.js` is requested. - Navigate to `/console` (Dashboard): ensure `visactor-*.js` loads as expected. --- web/vite.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/web/vite.config.js b/web/vite.config.js index 50ca06a5..75aa8153 100644 --- a/web/vite.config.js +++ b/web/vite.config.js @@ -60,7 +60,6 @@ export default defineConfig({ manualChunks: { 'react-core': ['react', 'react-dom', 'react-router-dom'], 'semi-ui': ['@douyinfe/semi-icons', '@douyinfe/semi-ui'], - visactor: ['@visactor/react-vchart', '@visactor/vchart'], tools: ['axios', 'history', 'marked'], 'react-components': [ 'react-dropzone',