Code Splitting
Dividing an application bundle so a page downloads only the code it needs.
Code splitting breaks an application's JavaScript into separate files so a visitor downloads only what a given route or interaction requires. Without it, every page pays for every feature.
The mechanism is a boundary the Bundler recognises — usually a dynamic import — which becomes a split point. Everything reachable only through that import moves into its own chunk, fetched on demand.
The part that surprises people is that splitting is a property of the module graph, not of intent. Bundlers commonly group every client reference reachable from a route into one shared chunk, so a page that renders any member of that group pulls the whole group. A server-side dynamic import does not split anything, because it never produced a client reference. A dynamic import called from a server component may not either. The boundary has to sit inside a client module to have any effect. See Module Graph and Client-Server Boundary.
This is why splitting must be measured rather than assumed. Two plausible refactors can both be byte-identical to the baseline. The verification is to build, download the chunks a page actually references, and search them for a marker from the code you meant to exclude.
See also5
Hand-picked in the note itself — the neighbours worth reading next.
Tree Shaking
Statically removing exports that nothing imports, shrinking the shipped bundle.
Web Platform9 connections
Lazy Loading
Deferring the fetch of a resource until it is needed, or until the browser is idle.
Web Platform12 connections
Performance Budget
A committed numeric ceiling on a page's cost, enforced automatically.
Web Platform16 connections
Ground Truth
The measurement that arbitrates, as opposed to the artifact that merely reports.
Method30 connections
React Server Components
Components that execute only on the server and never ship their code to the browser.
Web Platform16 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from9
Notes elsewhere in the wiki that reach for this one.
- BundlerWeb Platform
The tool that resolves an application's modules into the files a browser downloads.
- Client-Server BoundaryWeb Platform
The line in an application where execution moves from the server to the browser.
- Core Web VitalsWeb Platform
Google's small set of user-centred performance metrics: loading, interactivity, and visual stability.
- Lazy LoadingWeb Platform
Deferring the fetch of a resource until it is needed, or until the browser is idle.
- 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.
- React Server ComponentsWeb Platform
Components that execute only on the server and never ship their code to the browser.
- Tree ShakingWeb Platform
Statically removing exports that nothing imports, shrinking the shipped bundle.
- Web Font LoadingWeb Platform
How custom typefaces are fetched and shown, and why the cost is easy to misattribute.