Code Splitting Optimizer
When to Trigger
- •Large components detected (>100 KB)
- •Route-level bundling
- •"Optimize loading"
What to Do
- •Heavy components: Wrap in next/dynamic with loading fallback; use ssr: false for client-only (e.g. charts).
- •Routes: Rely on App Router automatic route splitting; avoid importing heavy modules from layout.
- •Vendor: Use splitChunks in next.config if needed (e.g. framework, UI lib, charts in separate chunks).
- •Conditional: Load modals, tabs, or below-fold sections only when needed (dynamic import on open or inView).
Keep initial bundle small; measure before/after. Don’t over-split tiny components.