Skip to content

Rollup

Medium — good to knowFrontend

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.

Made with passive-aggressive love by manoga.digital. Powered by Claude.