Code Splitting Playground

The crates of Dodi’s booking app: load each page with a static import, import() or import(variable). A model of Rolldown’s cut held to 27 Vite 8 builds splits…

Why it matters

A fat first crate means a slow first view, especially on a phone on a slow network. Splitting per page with import() (and React.lazy) gives a lot for a little, as long as what is split off is big and rarely opened, and the bundler can read where to cut.

The key idea

An import() with a fixed string is the line where the bundler cuts

Common mistakes

Try it in this playground