Impact: HIGH (reduces initial JavaScript bundle by deferring heavy libraries until needed)
Importing heavy client-side libraries at the top of a file forces the entire library into the initial bundle — even if the component is below the fold, behind a tab, or conditionally rendered. next/dynamic (Next.js's wrapper around React.lazy) code-splits these imports so they load only when needed.
Common offenders: chart libraries (Chart.js, Recharts), rich text editors (TipTap, Slate), map libraries (Leaflet, Mapbox), PDF viewers, syntax highlighters, and markdown renderers.
Incorrect (everything in the initial bundle):
'use client'// ❌ 200KB+ loaded immediately even if chart is below the foldimport { Chart } from 'chart.js/auto'import { Bar } from 'react-chartjs-2'// ❌ 500KB+ rich text editor loaded on a page where most users just readimport { Editor } from '@tiptap/react'import StarterKit from '@tiptap/starter-kit'// ❌ Heavy map library loaded on every page loadimport { MapContainer, TileLayer, Marker } from 'react-leaflet'export default function AnalyticsPage() { return ( <div> <h1>Dashboard</h1> <Bar data={chartData} /> <Editor extensions={[StarterKit]} /> <MapContainer center={[51.505, -0.09]} zoom={13}> <TileLayer url="..." /> </MapContainer> </div> )}