Agent Skills: bundle-dynamic-imports

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.

UncategorizedID: theorcdev/8bitcn-ui/bundle-dynamic-imports

Install this agent skill to your local

pnpm dlx add-skill https://github.com/TheOrcDev/8bitcn-ui/tree/HEAD/.claude/skills/bundle-dynamic-imports

Skill Files

Browse the full folder contents for bundle-dynamic-imports.

Download Skill

Loading file tree…

.claude/skills/bundle-dynamic-imports/SKILL.md

Skill Metadata

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