Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/bundle-dynamic-imports.md
1---2title: Dynamic Imports for Heavy Components3impact: CRITICAL4impactDescription: directly affects TTI and LCP5tags: bundle, dynamic-import, code-splitting, next-dynamic6---78## Dynamic Imports for Heavy Components910Use `next/dynamic` to lazy-load large components not needed on initial render.1112**Incorrect (Monaco bundles with main chunk ~300KB):**1314```tsx15import { MonacoEditor } from './monaco-editor'1617function CodePanel({ code }: { code: string }) {18return <MonacoEditor value={code} />19}20```2122**Correct (Monaco loads on demand):**2324```tsx25import dynamic from 'next/dynamic'2627const MonacoEditor = dynamic(28() => import('./monaco-editor').then(m => m.MonacoEditor),29{ ssr: false }30)3132function CodePanel({ code }: { code: string }) {33return <MonacoEditor value={code} />34}35```36