Why does a web project that ends up as HTML, CSS, and JavaScript have to be compiled before a browser can run it?
Sometimes there is a good answer. A team may want to write in TypeScript, or a product may have to support browsers that are many years old. But often the build is simply inherited: the project started from a template, the template came with a bundler, and every change since has passed through it. The code the developer writes and the code the browser runs become two different things, with a toolchain in between.
The reasons for a build have changed
Bundlers and transpilers answered real problems. Browsers lagged behind the language, so modern code had to be rewritten into an older dialect before it would run everywhere. Under HTTP/1.1, every file cost a separate request, so combining scripts into one bundle made pages load faster, and minification made them smaller still.
Most of that has since been solved by the platform itself. Current browsers run modern JavaScript as written. HTTP/2 and HTTP/3 carry many files over a single connection, and compression narrows the gap between minified and readable code. What remains is mostly a consequence of other choices: a project written in a language the browser does not run needs a compiler, but that requirement comes from the language, not from the web.
The web was built to deliver source
JavaScript is an interpreted scripting language. The file a developer writes is the program, and the browser is the runtime that executes it. Unlike a native application, there is no step between writing the code and running it that a build needs to fill.
The same is true of distribution. Browsers cache files, and HTTP was designed so that responses can be cached at every hop between server and user. In that sense, the browser and the internet itself already form a content delivery network—one that works best with files that change independently. When one module changes, only that file needs to travel again. A single bundle turns every small change into a new download of everything.
What the build costs
A build also puts a layer between the developer and the running program. The code in the browser’s developer tools is no longer the code in the editor, so debugging depends on source maps being generated and kept correct. The toolchain is software in its own right, with dependencies, configuration, and a release schedule of its own, and keeping it current is work that does nothing for the user. Every package it pulls in runs on the developer’s machine and in the deployment pipeline.
Without a build, the files in the repository are the files that are served, and writing for the runtime directly shapes the code as well. Browser JavaScript is event-driven and asynchronous, and code that reads as synchronous hides that. A static import looks like a step at the top of a file, while the browser fetches each module over the network before any of it runs. Plain callbacks and explicit events let the code keep the same shape as the runtime it describes.
Some projects do benefit from a build. A large application may gain from removing unused code, and a team may value the checks a typed language provides. The argument is not that every project should do without one.
The question is whether a particular project needs it. A small, dependency-free framework like triad.js shows how far the platform goes on its own: it runs multi-file single-page applications straight from disk, with no build step and no server. Before adding a build, it is worth asking whether it answers a limitation of the platform, or only a habit of the ecosystem.