Code splitting is the practice of splitting your application's JavaScript into multiple files (chunks) that load on demand, rather than shipping one giant bundle to every visitor. The goal is simple: send only the code the user needs for the current page, defer everything else.
Without code splitting, every user — whether they land on your login page, your dashboard, or your settings page — downloads the entire application. React, ReactDOM, every component, every chart library, every utility function. All of it. On a 3G connection with a 300 kB bundle, that is easily 2-3 seconds of JS parse and execute time before the page becomes interactive.
With code splitting, the initial load downloads only the code for the landing page. The dashboard code loads when the user navigates to it. The chart library loads when the user opens the analytics tab. The markdown editor loads when the user clicks "Edit". The result: faster first paint, lower total blocking time (TBT), and happier users.
Modern bundlers (webpack, Rollup, Turbopack) support code splitting natively. The key is understanding which strategy to use for which scenario.
There are four primary strategies, and they compose. A well-optimized app uses all four: route splitting for pages, component-level splitting for heavy widgets, dynamic imports for conditional modules, and vendor splitting for third-party library stability.