bundle-dynamic-imports

star 1.9k

Use next/dynamic for lazy-loading heavy components. Apply when importing large components like editors, charts, or rich text editors that aren't needed on initial render.

TheOrcDev By TheOrcDev schedule Updated 1/16/2026

name: bundle-dynamic-imports description: Use next/dynamic for lazy-loading heavy components. Apply when importing large components like editors, charts, or rich text editors that aren't needed on initial render.

Dynamic Imports for Heavy Components

Use next/dynamic to lazy-load large components not needed on initial render.

Incorrect (Monaco bundles with main chunk ~300KB):

import { MonacoEditor } from './monaco-editor'

function CodePanel({ code }: { code: string }) {
  return <MonacoEditor value={code} />
}

Correct (Monaco loads on demand):

import dynamic from 'next/dynamic'

const MonacoEditor = dynamic(
  () => import('./monaco-editor').then(m => m.MonacoEditor),
  { ssr: false }
)

function CodePanel({ code }: { code: string }) {
  return <MonacoEditor value={code} />
}
Install via CLI
npx skills add https://github.com/TheOrcDev/8bitcn-ui --skill bundle-dynamic-imports
Repository Details
star Stars 1,897
call_split Forks 113
navigation Branch main
article Path SKILL.md
More from Creator