Lazy-load report pages and split vendor chunks #602
Opentnakamura wants to merge 3 commits into main from perf/lazy-report-routes· opened 3 days ago
+70−6
tnakamura commented 3 days agoAuthor
Why
Lighthouse on the overview page is at 41. The main bundle is 2.3 MB because every report (and
echarts, deck.gl, the PDF exporter) is imported eagerly from App.tsx.
What
Switch to createBrowserRouter with a single reports/:slug route
Each report is loaded on demand with React.lazy + a dynamic import, and prefetched on hover
manualChunks moves third-party code into its own vendor chunk so it caches across deploys
Build target set to es2015 to match the support matrix on the pricing page
Results
index-*.js went from 2.3 MB to 180 kB locally. Raised the chunk size warning limit since the vendor
chunk trips the default 500 kB.
Why
Lighthouse on the overview page is at 41. The main bundle is 2.3 MB because every report (and echarts, deck.gl, the PDF exporter) is imported eagerly from
App.tsx.What
createBrowserRouterwith a singlereports/:slugrouteReact.lazy+ a dynamic import, and prefetched on hovermanualChunksmoves third-party code into its ownvendorchunk so it caches across deployses2015to match the support matrix on the pricing pageResults
index-*.jswent from 2.3 MB to 180 kB locally. Raised the chunk size warning limit since the vendor chunk trips the default 500 kB.