Rollup
ELI5 — The Vibe Check
Rollup is the bundler you use when you're building a library rather than an app. It's known for producing tiny, clean output because it pioneered tree shaking — cutting out all the code that nobody uses. Vite actually uses Rollup under the hood for production builds.
Real Talk
Rollup is a module bundler optimized for building JavaScript libraries. It was the first bundler to implement tree shaking at scale, producing minimal output by statically analyzing ES module imports. It outputs multiple formats (ESM, CJS, UMD) and is preferred for library authors.
Show Me The Code
// rollup.config.js
export default {
input: 'src/index.js',
output: [
{ file: 'dist/bundle.cjs.js', format: 'cjs' },
{ file: 'dist/bundle.esm.js', format: 'esm' }
]
}
When You'll Hear This
We use Rollup to build the component library.,Rollup's tree shaking kept the output under 5KB.,Vite uses Rollup for production builds internally.
Related Terms
Bundler
A bundler is the robot that smashes all your separate JavaScript files, CSS, images, and random imports into one (or a few) neat packages that the browser...
esbuild
esbuild is a bundler written in Go (not JavaScript) which means it's absolutely unhinged fast — like 10-100x faster than other bundlers.
Tree Shaking
Tree shaking is when your bundler looks at all the code you imported but never actually used, and throws it in the trash.
Vite
Vite is what happens when someone got sick of waiting 30 seconds for Webpack to start.