Skip to main content

2 posts tagged with "bundlers"

View All Tags

How JavaScript Bundlers Work: A Field Guide from 2012 to 2026

· 14 min read
Pere Pages
Software Engineer
Editorial illustration of scattered code modules flowing along conveyor belts into a funnel that outputs a few neat, bundled packages

Bundlers are the most invisible critical infrastructure in frontend development. Every npm run dev and every continuous-integration (CI) pipeline runs through one, yet most of us only think about them when something breaks or when a migration guide lands in our feed. This post is an attempt to fix that: what a bundler actually does under the hood, how we got from script tags to Rust toolchains, which tool owns which niche today, and where the whole thing is heading.

Tree shaking, an example with barrels

· 5 min read
Pere Pages
Software Engineer
Tree shake
Tree shaking

Tree shaking is a term used in the context of web development, particularly with JavaScript and modern front-end build tools, to describe the process of removing unused code from your final bundle. It's like shaking a tree to let the dead leaves (unused code) fall off, so you end up with a lighter, more efficient bundle that only includes the code that's actually used in your application.

This concept became particularly relevant with the rise of module bundlers like Webpack, Rollup, and tools like Parcel, which analyze your import and export statements to determine which parts of a module are used by your application. If a function, class, or variable from a module is never used, the bundler can exclude it from the output bundle, reducing the size of your application and improving load times for your users.