talira

ES module bundler for JavaScript libraries and apps, with tree shaking

open sourceMITfree

Rollup is a module bundler for JavaScript that combines ES modules into a bundle for a library or an application, removing code that isn't used (tree shaking). It outputs ES modules, CommonJS, AMD, UMD and IIFE scripts, so code written as ES modules runs in browsers and Node.js versions that don't load them natively. It runs from the command line with an optional config file or through its JavaScript API, and a plugin system handles CommonJS imports, Node resolution, TypeScript, Babel, minification and more through the official @rollup/plugin-* packages. Parts of its core, including the parser, are written in Rust.

Problems it solves

  • bundle my JavaScript library into ESM and CommonJS builds for npm
  • remove unused code from my JavaScript bundle
  • build one small JavaScript file for the browser from many ES modules

Features

  • Bundles ES modules into one file for a library or app
  • Tree shaking removes code that isn't used
  • Outputs ES modules, CommonJS, AMD, UMD and IIFE
  • Command line with a config file, or a JavaScript API
  • Official plugins for CommonJS, node resolution, TypeScript, Babel, aliases and Terser

Limitations

  • Importing CommonJS modules from node_modules needs the official @rollup/plugin-commonjs plugin1

Capabilities

Has an APIplan not known
Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what Rollup does.

  1. esbuild An extremely fast bundler for the web
  2. webpack A bundler for javascript and friends
  3. Parcel The zero configuration build tool for the web
  4. Rolldown Fast Rust bundler for JavaScript and TypeScript with a Rollup-compatible API
  5. tsdown Library bundler for TypeScript and JavaScript, built on Rolldown
  6. TSDX Zero-config CLI for developing, testing and publishing TypeScript packages

Compare Rollup with the top 3