Heavy libraries use dynamic imports (not loaded on every page)
Why it matters
A charting library like Recharts (180KB gzipped) or a rich text editor like Monaco (2MB) statically imported in a shared layout loads on every page — even the marketing homepage, authentication screens, and error pages that never render a chart or editor. This adds hundreds of milliseconds of unnecessary parse time to routes where the library is invisible. ISO 25010 performance-efficiency.time-behaviour requires time-behaviour to be proportionate to the task being performed; serving 2MB of editor JavaScript to a user reading a blog post is not proportionate.
Severity rationale
Low because heavy static imports increase parse time on unrelated pages, but they do not prevent functionality and often go unnoticed until measured.
Remediation
Move heavy library imports from static top-level imports to dynamic imports scoped to the component or route that actually uses them. Use next/dynamic in Next.js or React.lazy elsewhere, combined with a skeleton placeholder.
// Before — loads Monaco on every page
import MonacoEditor from '@monaco-editor/react'
// After — loads only on /editor route
import dynamic from 'next/dynamic'
const MonacoEditor = dynamic(() => import('@monaco-editor/react'), {
loading: () => <Skeleton className="h-64 w-full" />,
ssr: false // Monaco doesn't support SSR
})
// Before — Recharts in layout.tsx
import { BarChart, BarChartData } from 'recharts'
// After — in the specific dashboard component
const AnalyticsChart = dynamic(
() => import('./AnalyticsChart'), // AnalyticsChart wraps recharts
{ loading: () => <Skeleton />, ssr: false }
)
Verify the split worked by confirming recharts/monaco no longer appears in the main chunk in your bundle analyzer output.
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 & Load Readiness Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · performance-efficiency.time-behaviour — Time Behaviour
Taxons
History
- 2026-04-18·v1.0.0·Initial import from performance-load·automated