It’s common for app users to interact with some components more than others. In the bookings app, for example, users often visit the Bookings page without switching to the Bookables or Users pages, and on the Bookables page they may never bring up the New or Edit forms. To manage the amount of code loaded by the browser at any one time, we can use a technique called code splitting; rather than loading all of an app’s code at once, we load it in chunks, as it’s needed.
So far in this book, all of our examples have used static imports. At the top of each JavaScript file, we include import statements to specify dependencies, the code in external files that the current file uses. At build time, bundlers like webpack inspect our code, follow the paths to the imported files, and generate a bundle, a file that contains all the code the app actually uses. Our web pages then request the bundle.