perf: lazy-load heavy routes, on-demand highlight.js, and optimize first-load UX
Closed
MA
6mo ago+900+900+012345678901234567890123456789-862-862-012345678901234567890123456789
Summary
- Route-level code splitting: lazy-load Docs (13 kB), Playground (17 kB), and Embed route components via TanStack Router
.lazy.tsxfiles - highlight.js (66 kB JS + 2 kB CSS) loaded dynamically only in the embed route, removed from global bundle
- Filled in missing manifest.json
name,short_name, anddescriptionfor PWA install - Added
preconnect/dns-prefetchhints for unpkg.com CDN - Added top loading bar animation during route transitions
- DevTools panels now dynamic imports (tree-shaken in production)
- Removed unused
jsdomand@testing-library/domdependencies - Build target set to
esnextfor smaller modern-browser output
Test plan
-
pnpm validatepasses (lint + check + test + test:artifacts + build) - 19 package tests + 21 site tests all pass
- Build produces separate lazy chunks for Docs, Playground, and Embed routes
- hljs CSS chunk only loaded for embed route
š¤ Generated with Claude Code
Summary by cubic
Speeds up first load by lazy-loading Docs, Playground, and Embed routes and loading highlight.js only when needed. Also adds a small loading bar during route transitions and improves PWA metadata.
-
Performance
- Route-level code splitting via
.lazy.tsxfor Docs, Playground, and Embed. - Load
highlight.js(66 kB JS + 2 kB CSS) only on the embed route; removed from global bundle. - DevTools panels now dynamic imports in dev; tree-shaken in production.
- Added
preconnect/dns-prefetchforhttps://unpkg.com. - Build target set to
esnextwith CSS minification for smaller modern bundles. - Removed unused deps:
jsdom,@testing-library/dom.
- Route-level code splitting via
-
UX
- Added a thin top loading bar during route transitions.
- PWA manifest now includes
name,short_name, anddescription.