react-router-tree-shaking-compare
react-router-tree-shaking-compare Explanation
This repo is a benchmark tool that measures how efficiently different JavaScript bundlers can remove unused code. When you build a web app, bundlers are supposed to strip out code you don't actually use—a process called "tree-shaking." This project tests whether they actually do that, and how well.
The test is straightforward: it imports three components from the popular react-router library, uses them, and then measures the size of the final bundled output. The smaller the bundle, the better the bundler is at eliminating code that doesn't get used. The repo includes comparisons across ten different bundlers—including Vite, webpack, esbuild, and others—showing both the raw file size and the size after compression (which is what users actually download).
The results show meaningful differences. Rspack and Rsbuild produce the smallest bundles at around 36 kB minified (13 kB compressed), while Bun's output is nearly twice as large. For apps dealing with large libraries, these differences compound: a bundler that's 20% more efficient saves real bandwidth and load time for every user.
A developer evaluating which bundler to use for a new project would find this useful—especially if bundle size matters, like for mobile apps or CDN-heavy services. The repo is also valuable for bundler maintainers trying to optimize their own tree-shaking implementations, since it provides a standardized test case and publishes the results clearly. If you're making a choice between build tools and size is a concern, this gives you a concrete, comparable reference point.