Lazy Loading
Deferring the fetch of a resource until it is needed, or until the browser is idle.
Lazy loading defers fetching a resource — a script, an image, a component, a font — until something establishes that it is needed. It is the most reliable way to reduce what a page costs on first load, because the cheapest byte is the one never requested.
Common forms include images and iframes deferred until near the viewport (now a native HTML attribute), components loaded on interaction or on visibility, and route code fetched when a route is entered. On the server side the equivalent is deferring a slow data fetch behind a streaming boundary so the shell renders immediately.
Two hazards recur. Deferral changes timing, and timing is observable. A script that only loads after a genuine user gesture will not load in an automated test that dispatches a synthetic event at an element rather than at the document — a real class of test that passes locally and fails in headless. Deferral can be undone by accident, since a single eager import elsewhere in the graph can pull the deferred module back into the initial chunk. See Module Graph.
Lazy loading interacts with perceived performance rather than just measured performance: something loading late is only an improvement if the page is usable meanwhile, which is what skeleton states and streaming boundaries provide.
See also6
Code Splitting
Dividing an application bundle so a page downloads only the code it needs.
Web Platform13 connections
Critical Rendering Path
The sequence of steps between receiving HTML and painting pixels, and everything that blocks it.
Web Platform11 connections
Core Web Vitals
Google's small set of user-centered performance metrics: loading, interactivity, and visual stability.
Web Platform16 connections
Islands Architecture
Rendering a page as static HTML with small independently interactive regions.
Web Platform16 connections
React Server Components
Components that execute only on the server and never ship their code to the browser.
Web Platform18 connections
Streaming Response
Delivering a response incrementally as it is produced rather than all at once when complete.
Networks & Distribution17 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from12
- Client-Server BoundaryWeb Platform
The line in an application where execution moves from the server to the browser.
- Code SplittingWeb Platform
Dividing an application bundle so a page downloads only the code it needs.
- Core Web VitalsWeb Platform
Google's small set of user-centered performance metrics: loading, interactivity, and visual stability.
- Critical Rendering PathWeb Platform
The sequence of steps between receiving HTML and painting pixels, and everything that blocks it.
- HydrationWeb Platform
Attaching client-side behavior to server-rendered markup without rebuilding it.
- Islands ArchitectureWeb Platform
Rendering a page as static HTML with small independently interactive regions.
- Module GraphWeb Platform
The directed graph of imports that decides what code ends up where.
- Performance BudgetWeb Platform
A committed numeric ceiling on a page's cost, enforced automatically.
- Preload and PrefetchWeb Platform
Two resource hints with opposite priorities — preload for what this page needs now, prefetch for what the next page might need.
- React Server ComponentsWeb Platform
Components that execute only on the server and never ship their code to the browser.
- Streaming ResponseNetworks & Distribution
Delivering a response incrementally as it is produced rather than all at once when complete.
- Tree ShakingWeb Platform
Statically removing exports that nothing imports, shrinking the shipped bundle.