# Bundle Dynamic Imports

> Bundle Dynamic Imports is an Agent Skill for development published in the TheOrcDev/8bitcn-ui repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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.

- Skill name: `bundle-dynamic-imports`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/TheOrcDev/8bitcn-ui/blob/HEAD/.claude/skills/bundle-dynamic-imports/SKILL.md
- Repository: TheOrcDev/8bitcn-ui (1,945 GitHub stars when collected)

## SKILL.md

## 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):**

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

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

**Correct (Monaco loads on demand):**

```tsx
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} />
}
```

---

Source: https://www.openparable.com/skill/development/bundle-dynamic-imports (OpenParable). Cite the canonical URL above.
