A bundler is a tool that assembles JavaScript (and CSS) from dozens or hundreds of modules into one or a few optimised files for the browser. The browser cannot efficiently load thousands of small files.
What it does
Module bundling — combines ES modules, CommonJS into one bundle
Tree shaking — removes unused code
Code splitting — splits into chunks loaded lazily
Transpiling — TypeScript, JSX → JavaScript via Babel/SWC
Asset optimisation — minification, filename hashing for cache busting
Popular bundlers
Vite — dev server on ESM, build via Rollup. Very fast HMR
Webpack — the standard for many years, huge plugin ecosystem
Rollup — optimal for libraries, excellent tree-shaking
esbuild — written in Go, 10–100× faster than Webpack