126
code splitting
The first screen does not download the admin editor. Load a route when the user opens it.
What is code splitting?
Code splitting breaks the bundle into pieces loaded on demand. The entry chunk is what the first paint needs. The rest waits for a route, a tab, or an interaction. A split that loads immediately is not a split.
Why does code splitting matter when vibe coding?
Models import the chart library into the homepage “so it is ready.” The phone downloads a megabyte before the title. Name the entry chunk and what is lazy.
How do you do code splitting?
Lazy-load routes and heavy widgets. Keep the shared shell small. Do not prefetch everything on load. Show a local placeholder, not a blank app.
How do you ask a model for code splitting?
Code-split (feature) out of the entry bundle. Load it when the route opens. Do not import it from the root layout. The first paint must not wait on it.
What goes wrong with code splitting?
Splitting into a hundred files that all load at once. You paid the request cost and kept the weight.