Dynamic imports for heavy UI components
Why it matters
Charting libraries (Recharts, Chart.js), code editors (Monaco), and rich-text editors routinely weigh 100–300KB gzipped each. Importing any of them statically means that weight lands in the initial bundle, inflating Time to Interactive for every page — including pages where the component never renders. ISO 25010:2011 time-behaviour captures the latency hit; the business impact is users abandoning a landing page because a chart used only on the analytics dashboard was eagerly loaded.
Severity rationale
Medium because heavy UI components inflate the initial bundle and delay interactivity even on pages where those components are not displayed, though the impact is proportional to the library sizes involved.
Remediation
Wrap any component over 50KB gzipped in a dynamic import with a loading fallback. In Next.js, use next/dynamic with ssr: false for browser-only libraries like canvas-based charts.
// components/analytics-chart.tsx
import dynamic from 'next/dynamic'
const LineChart = dynamic(
() => import('recharts').then((m) => m.LineChart),
{ ssr: false, loading: () => <Skeleton className="h-64 w-full" /> }
)
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Performance Deep Dive Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · time-behaviour — Time Behaviour (performance efficiency)
Taxons
History
- 2026-04-18·v1.0.0·Initial import from performance-deep-dive·automated