You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The prerendered homepage currently inherits JavaScript and CSS owned by the React Router root route even when those resources are only needed by content, search, or playground routes. The homepage also has opportunities to reduce DOM complexity, effects, and image transfer costs.
DocsRoot is the React Router root route and should retain only resources genuinely shared by every route. Route-specific resources should move into matched child layouts or lazy boundaries.
Current baseline
22 initial JavaScript assets, approximately 275 KB gzip
Shared root chunk approximately 125 KB gzip
Initial CSS approximately 14.8 KB gzip
419 body elements
63 homepage images
61 images without width; all 63 without height
No responsive picture or srcset output
These are starting measurements rather than final budgets. Deterministic build metrics should be recorded and ratcheted down as the work lands.
Add responsive-image Vite integration, tuned source sets, and intrinsic dimensions for all homepage images and videos
Lazy-load DocSearch, search-insights, and search-specific CSS after activation
Precompute homepage code highlighting during prerendering
Move syntax registration out of the root route and make content highlighting dependencies explicit
Add pathless landing, content, and playground layouts and split Tailwind/CSS ownership by matched route
Add React Compiler in annotation mode and incrementally opt cleaned homepage modules into compilation
Implementation notes
Tests and measurements
Playwright is already installed and Vitest already uses its browser provider. Add a standalone Playwright configuration for tests against the production/prerendered artifact while keeping Vitest as the component and integration layer.
Test direct loading and client navigation between the homepage, documentation, and playground routes. Assert hydration without page or console errors, preserve critical links and interactions, and avoid timing-based Lighthouse gates in CI.
Root and syntax payloads
The root route currently owns global styles, Highlight.js language registration, the navbar, and the eager search dependency. The homepage also performs runtime highlighting for two static examples and carries an unused Markdown component dependency.
Move fixed homepage highlighting into its prerender loader. Scope content highlighting explicitly so the homepage does not preload Highlight.js core, the full language set, Markdown, or MarkdownComponents.
Route CSS
Split styles into shared foundation, landing, content, playground, and lazy search inputs. Use pathless layouts and route links exports to associate resources with matched routes. Ensure Tailwind theme/preflight is emitted once, and verify cascade order and flashes during client navigation.
Images
Use @responsive-image/react, @responsive-image/vite-plugin, and @responsive-image/core for the five raster placements that benefit from adaptive variants. Keep small illustrations, icons, logos, and video posters simple, but give every image and video accurate intrinsic dimensions and appropriate loading priority.
Measure the responsive-image React runtime because the supported component currently uses an effect per mounted image.
React Compiler
Configure annotation mode targeting React 19 and opt in only homepage modules with stable component boundaries and cleaned-up effects. Keep existing manual memoization during the initial rollout.
Acceptance criteria
Every layer passes ReScript compilation, Vitest, production build, built-site Playwright tests, and the homepage asset report
Root JavaScript contains no eager DocSearch, search-insights, or global syntax-language registration
Homepage initial assets exclude Markdown, MarkdownComponents, and the full Highlight.js runtime
Search implementation and styles load only after activation
Responsive raster placements emit picture, srcset, and accurate sizes
Every homepage image and video has numeric intrinsic dimensions
Below-fold images do not become initial preload candidates
Homepage CSS excludes documentation, DocSearch, and playground-only rules
Direct loads and client transitions preserve styling and syntax highlighting without hydration errors
Theme and preflight are emitted only once per page
React Compiler is enabled incrementally without behavior or bundle regressions
Each completed PR records before/after raw and gzip asset totals
Context
The prerendered homepage currently inherits JavaScript and CSS owned by the React Router root route even when those resources are only needed by content, search, or playground routes. The homepage also has opportunities to reduce DOM complexity, effects, and image transfer costs.
DocsRoot is the React Router root route and should retain only resources genuinely shared by every route. Route-specific resources should move into matched child layouts or lazy boundaries.
Current baseline
These are starting measurements rather than final budgets. Deterministic build metrics should be recorded and ratcheted down as the work lands.
Proposed PR stack
Implementation notes
Tests and measurements
Playwright is already installed and Vitest already uses its browser provider. Add a standalone Playwright configuration for tests against the production/prerendered artifact while keeping Vitest as the component and integration layer.
Test direct loading and client navigation between the homepage, documentation, and playground routes. Assert hydration without page or console errors, preserve critical links and interactions, and avoid timing-based Lighthouse gates in CI.
Root and syntax payloads
The root route currently owns global styles, Highlight.js language registration, the navbar, and the eager search dependency. The homepage also performs runtime highlighting for two static examples and carries an unused Markdown component dependency.
Move fixed homepage highlighting into its prerender loader. Scope content highlighting explicitly so the homepage does not preload Highlight.js core, the full language set, Markdown, or MarkdownComponents.
Route CSS
Split styles into shared foundation, landing, content, playground, and lazy search inputs. Use pathless layouts and route links exports to associate resources with matched routes. Ensure Tailwind theme/preflight is emitted once, and verify cascade order and flashes during client navigation.
Images
Use @responsive-image/react, @responsive-image/vite-plugin, and @responsive-image/core for the five raster placements that benefit from adaptive variants. Keep small illustrations, icons, logos, and video posters simple, but give every image and video accurate intrinsic dimensions and appropriate loading priority.
Measure the responsive-image React runtime because the supported component currently uses an effect per mounted image.
React Compiler
Configure annotation mode targeting React 19 and opt in only homepage modules with stable component boundaries and cleaned-up effects. Keep existing manual memoization during the initial rollout.
Acceptance criteria