Challenge 1: Why Vite's Dev Startup Doesn't Scale With Project Size — Possible Solution ==================================================================== WHY WEBPACK'S DEV STARTUP SCALES WITH PROJECT SIZE ------------------------------ Per build-tooling1-3, Webpack has to bundle the ENTIRE dependency graph before it can serve even a single page in development. The larger the project (the more files, the more dependencies), the bigger that graph is, and the longer it takes to fully process and bundle it before the dev server can respond to the first request at all. Startup time is directly tied to how much code exists in the project. WHY VITE'S DOESN'T ------------------------------ Per this chapter's own explanation, Vite's dev server doesn't bundle the application's own source code at all — it serves source files directly and relies on the browser's OWN native ES module support to fetch and resolve them, file by file, over the network, exactly as the browser encounters real import statements while actually loading the page. Since there's no upfront step that has to process the entire dependency graph before anything can be served, there's no work whose size scales with "how many files exist in the whole project" standing between starting the dev server and it being ready to respond. THE CONCRETE CONSEQUENCE ------------------------------ A Vite dev server can start almost immediately regardless of whether the project has 10 files or 10,000, because starting the server doesn't require first walking and bundling all 10,000 of them — it only needs to be ready to serve whichever specific files a browser actually requests, as it requests them (with node_modules dependencies handled by the separate, one-time esbuild pre-bundling step this chapter also covers). Webpack, by contrast, genuinely has more total work to do before it can serve anything at all, and that amount of work grows directly with project size. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains specifically WHY Webpack's own startup time scales with project size (the mandatory full-graph bundle before serving anything), and contrasts it against Vite's own mechanism (serving files on demand via native browser ESM resolution, with no equivalent mandatory full-graph step), rather than simply asserting Vite is faster.