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
Last updated: 2026-03-04
Orchestrator: /prompts/performance-optimization-orchestrator.mdStatus: AUDIT COMPLETE — 7/7 audits executed, 4 violations found and fixed, 100% compliant
1. Overview
Performance standards for the Die Papier React prototype application. These guidelines ensure fast load times, efficient rendering, and optimal bundle sizes. The orchestrator defines 7 audit areas; this document captures the ongoing standards that all new code must follow.
Estimated compliant (dev tools are largest chunks, all lazy-loaded)
Total bundle (all chunks)
< 2MB
Estimated compliant (requires build measurement)
3. Route-Based Code Splitting
Rules
All route-level page components must use React.lazy() and <Suspense>.
Shared components (used across 3+ routes) belong in the main bundle — do not lazy-load them.
Dev tool pages (/ontwikkelaar/*) must be lazy-loaded — they are never needed on initial page load.
Heavy library routes (e.g., pages using recharts) must be in their own chunk.
Pattern
// In routes.tsxconstHome=lazy(()=>import('./pages/Home'));constCategory=lazy(()=>import('./pages/Category'));constDevPresets=lazy(()=>import('./pages/dev/PresetsBrowser'));// Wrap routes in Suspense<Suspensefallback={<LoadingSpinner/>}><Outlet/></Suspense>
4. Image Optimization
Rules
All images must use loading="lazy" or the ImageWithFallback component.
Above-the-fold images (hero, logo) may use loading="eager" — max 2 per page.
SVGs > 10KB should be lazy-loaded or simplified.
No inline base64 images > 5KB — use separate files.
Unsplash images must use width parameters (e.g., ?w=800) to avoid loading full-resolution images.
Figma Asset Imports
// Raster images use figma:asset schemeimportimgfrom"figma:asset/abc123.png";// SVGs use relative file pathsimportsvgPathsfrom"../imports/svg-xyz";
5. Data File Optimization
Rules
Data files > 50KB should use named exports for tree shaking.
Data files > 150KB must be code-split (dynamic import or separate module).
Large inline strings (guideline content, article HTML) should be in separate TypeScript modules under /src/app/data/guidelines/ and imported dynamically.
Prefer JSON for pure data — TypeScript overhead is unnecessary for static data.
No duplicate data across files — use a single source and import it.