rollup
Next-generation ES module bundler
Last updated 9 months ago by lukastaegert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rollup 
SYNC missed versions from official npm registry.

Rollup

npm version install size code coverage backers sponsors license dependency status Join the chat at https://gitter.im/rollup/rollup

Overview

Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today.

Quick Start Guide

Install with npm install --global rollup. Rollup can be used either through a command line interface with an optional configuration file, or else through its JavaScript API. Run rollup --help to see the available options and parameters. The starter project templates, rollup-starter-lib and rollup-starter-app, demonstrate common configuration options, and more detailed instructions are available throughout the user guide.

Commands

These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js.

For browsers:

# compile to a <script> containing a self-executing function
$ rollup main.js --format iife --name "myBundle" --file bundle.js

For Node.js:

# compile to a CommonJS module
$ rollup main.js --format cjs --file bundle.js

For both browsers and Node.js:

# UMD format requires a bundle name
$ rollup main.js --format umd --name "myBundle" --file bundle.js

Why

Developing software is usually easier if you break your project into smaller separate pieces, since that often removes unexpected interactions and dramatically reduces the complexity of the problems you'll need to solve, and simply writing smaller projects in the first place isn't necessarily the answer. Unfortunately, JavaScript has not historically included this capability as a core feature in the language.

This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. The specification is now implemented in all major browsers and in Node.js behind the --experimental-modules flag for ".mjs" files. Rollup allows you to write your code using this module system, either outputting optimized ES modules for use in these native environments, or compiling it back down to existing supported formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to write future-proof code, and you also get the tremendous benefits of...

Tree Shaking

In addition to enabling the use of ES modules, Rollup also statically analyzes and optimizes the code you are importing, and will exclude anything that isn't actually used. This allows you to build on top of existing tools and modules without adding extra dependencies or bloating the size of your project.

For example, with CommonJS, the entire tool or library must be imported.

// import the entire utils object with CommonJS
var utils = require( 'utils' );
var query = 'Rollup';
// use the ajax method of the utils object
utils.ajax( 'https://api.example.com?search=' + query ).then( handleResponse );

But with ES modules, instead of importing the whole utils object, we can just import the one ajax function we need:

// import the ajax function with an ES import statement
import { ajax } from 'utils';
var query = 'Rollup';
// call the ajax function
ajax( 'https://api.example.com?search=' + query ).then( handleResponse );

Because Rollup includes the bare minimum, it results in lighter, faster, and less complicated libraries and applications. Since this approach is based on explicit import and export statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code.

Compatibility

Importing CommonJS

Rollup can import existing CommonJS modules through a plugin.

Publishing ES Modules

To make sure your ES modules are immediately usable by tools that work with CommonJS such as Node.js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the main property in your package.json file. If your package.json file also has a module field, ES-module-aware tools like Rollup and webpack 2 will import the ES module version directly.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! ???? [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

MIT

Current Tags

  • 1.27.8                                ...           latest (4 days ago)

379 Versions

  • 1.27.8                                ...           4 days ago
  • 1.27.7                                ...           4 days ago
  • 1.27.6                                ...           5 days ago
  • 1.27.5                                ...           11 days ago
  • 1.27.4                                ...           14 days ago
  • 1.27.3                                ...           15 days ago
  • 1.27.2                                ...           17 days ago
  • 1.27.1                                ...           18 days ago
  • 1.27.0                                ...           23 days ago
  • 1.26.5                                ...           25 days ago
  • 1.26.4                                ...           a month ago
  • 1.26.3                                ...           a month ago
  • 1.26.2                                ...           a month ago
  • 1.26.1                                ...           a month ago
  • 1.26.0                                ...           a month ago
  • 1.25.2                                ...           a month ago
  • 1.25.1                                ...           a month ago
  • 1.25.0                                ...           2 months ago
  • 1.24.0                                ...           2 months ago
  • 1.23.1                                ...           2 months ago
  • 1.23.0                                ...           2 months ago
  • 1.22.0                                ...           2 months ago
  • 1.21.4                                ...           3 months ago
  • 1.21.3                                ...           3 months ago
  • 1.21.2                                ...           3 months ago
  • 1.21.1                                ...           3 months ago
  • 1.21.0                                ...           3 months ago
  • 1.20.3                                ...           3 months ago
  • 1.20.2                                ...           3 months ago
  • 1.20.1                                ...           3 months ago
  • 1.20.0                                ...           3 months ago
  • 1.19.4                                ...           4 months ago
  • 1.19.3                                ...           4 months ago
  • 1.19.2                                ...           4 months ago
  • 1.19.1                                ...           4 months ago
  • 1.19.0                                ...           4 months ago
  • 1.18.0                                ...           4 months ago
  • 1.17.0                                ...           5 months ago
  • 1.16.7                                ...           5 months ago
  • 1.16.6                                ...           5 months ago
  • 1.16.5                                ...           5 months ago
  • 1.16.4                                ...           5 months ago
  • 1.16.3                                ...           5 months ago
  • 1.16.2                                ...           5 months ago
  • 1.16.1                                ...           5 months ago
  • 1.16.0                                ...           5 months ago
  • 1.15.6                                ...           6 months ago
  • 1.15.5                                ...           6 months ago
  • 1.15.4                                ...           6 months ago
  • 1.15.3                                ...           6 months ago
  • 1.15.2                                ...           6 months ago
  • 1.15.1                                ...           6 months ago
  • 1.15.0                                ...           6 months ago
  • 1.14.6                                ...           6 months ago
  • 1.14.5                                ...           6 months ago
  • 1.14.4                                ...           6 months ago
  • 1.14.3                                ...           6 months ago
  • 1.14.2                                ...           6 months ago
  • 1.14.1                                ...           6 months ago
  • 1.14.0                                ...           6 months ago
  • 1.13.1                                ...           6 months ago
  • 1.13.0                                ...           6 months ago
  • 1.12.5                                ...           6 months ago
  • 1.12.4                                ...           6 months ago
  • 1.12.3                                ...           7 months ago
  • 1.12.2                                ...           7 months ago
  • 1.12.1                                ...           7 months ago
  • 1.12.0                                ...           7 months ago
  • 1.11.3                                ...           7 months ago
  • 1.11.2                                ...           7 months ago
  • 1.11.1                                ...           7 months ago
  • 1.11.0                                ...           7 months ago
  • 1.10.1                                ...           8 months ago
  • 1.10.0                                ...           8 months ago
  • 1.9.3                                ...           8 months ago
  • 1.9.2                                ...           8 months ago
  • 1.9.1                                ...           8 months ago
  • 1.9.0                                ...           8 months ago
  • 1.8.0                                ...           8 months ago
  • 1.7.4                                ...           8 months ago
  • 1.7.3                                ...           8 months ago
  • 1.7.2                                ...           8 months ago
  • 1.7.1                                ...           8 months ago
  • 1.7.0                                ...           9 months ago
  • 1.6.1                                ...           9 months ago
  • 1.6.0                                ...           9 months ago
  • 1.5.0                                ...           9 months ago
  • 1.4.2                                ...           9 months ago
  • 1.4.1                                ...           9 months ago
  • 1.4.0                                ...           9 months ago
  • 1.3.3                                ...           9 months ago
  • 1.3.2                                ...           9 months ago
  • 1.3.1                                ...           9 months ago
  • 1.3.0                                ...           9 months ago
  • 1.2.5                                ...           9 months ago
  • 1.2.4                                ...           9 months ago
  • 1.2.3                                ...           9 months ago
  • 1.2.2                                ...           10 months ago
  • 1.2.1                                ...           10 months ago
  • 1.2.0                                ...           10 months ago
  • 1.1.2                                ...           10 months ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.68.2                                ...           a year ago
  • 0.68.1                                ...           a year ago
  • 0.68.0                                ...           a year ago
  • 0.67.4                                ...           a year ago
  • 0.67.3                                ...           a year ago
  • 0.67.2                                ...           a year ago
  • 0.67.1                                ...           a year ago
  • 0.67.0                                ...           a year ago
  • 0.66.6                                ...           a year ago
  • 0.66.5                                ...           a year ago
  • 0.66.4                                ...           a year ago
  • 0.66.3                                ...           a year ago
  • 0.66.2                                ...           a year ago
  • 0.66.1                                ...           a year ago
  • 0.66.0                                ...           a year ago
  • 0.65.2                                ...           a year ago
  • 0.65.1                                ...           a year ago
  • 0.65.0                                ...           a year ago
  • 0.64.1                                ...           a year ago
  • 0.64.0                                ...           a year ago
  • 0.63.5                                ...           a year ago
  • 0.63.4                                ...           a year ago
  • 0.63.3                                ...           a year ago
  • 0.63.2                                ...           a year ago
  • 0.63.1                                ...           a year ago
  • 0.63.0                                ...           a year ago
  • 0.62.0                                ...           a year ago
  • 0.61.2                                ...           a year ago
  • 0.61.1                                ...           a year ago
  • 0.61.0                                ...           a year ago
  • 0.60.7                                ...           a year ago
  • 0.60.6                                ...           a year ago
  • 0.60.5                                ...           a year ago
  • 0.60.4                                ...           a year ago
  • 0.60.3                                ...           a year ago
  • 0.60.2                                ...           a year ago
  • 0.60.1                                ...           a year ago
  • 0.60.0                                ...           a year ago
  • 0.59.4                                ...           2 years ago
  • 0.59.3                                ...           2 years ago
  • 0.59.2                                ...           2 years ago
  • 0.59.1                                ...           2 years ago
  • 0.59.0                                ...           2 years ago
  • 0.58.2                                ...           2 years ago
  • 0.58.1                                ...           2 years ago
  • 0.58.0                                ...           2 years ago
  • 0.57.1                                ...           2 years ago
  • 0.57.0                                ...           2 years ago
  • 0.56.5                                ...           2 years ago
  • 0.56.4                                ...           2 years ago
  • 0.56.3                                ...           2 years ago
  • 0.56.2                                ...           2 years ago
  • 0.56.1                                ...           2 years ago
  • 0.56.0                                ...           2 years ago
  • 0.55.5                                ...           2 years ago
  • 0.55.4                                ...           2 years ago
  • 0.55.3                                ...           2 years ago
  • 0.55.2                                ...           2 years ago
  • 0.55.1                                ...           2 years ago
  • 0.55.0                                ...           2 years ago
  • 0.54.1                                ...           2 years ago
  • 0.54.0                                ...           2 years ago
  • 0.53.4                                ...           2 years ago
  • 0.53.3                                ...           2 years ago
  • 0.53.2                                ...           2 years ago
  • 0.53.1                                ...           2 years ago
  • 0.53.0                                ...           2 years ago
  • 0.52.3                                ...           2 years ago
  • 0.52.2                                ...           2 years ago
  • 0.52.1                                ...           2 years ago
  • 0.52.0                                ...           2 years ago
  • 0.51.8                                ...           2 years ago
  • 0.51.7                                ...           2 years ago
  • 0.51.6                                ...           2 years ago
  • 0.51.5                                ...           2 years ago
  • 0.51.4                                ...           2 years ago
  • 0.51.3                                ...           2 years ago
  • 0.51.2                                ...           2 years ago
  • 0.51.1                                ...           2 years ago
  • 0.51.0                                ...           2 years ago
  • 0.50.1                                ...           2 years ago
  • 0.50.0                                ...           2 years ago
  • 0.49.3                                ...           2 years ago
  • 0.49.2                                ...           2 years ago
  • 0.49.1                                ...           2 years ago
  • 0.49.0                                ...           2 years ago
  • 0.48.2                                ...           2 years ago
  • 0.48.1                                ...           2 years ago
  • 0.48.0                                ...           2 years ago
  • 0.47.6                                ...           2 years ago
  • 0.47.5                                ...           2 years ago
  • 0.47.4                                ...           2 years ago
  • 0.47.3                                ...           2 years ago
  • 0.47.2                                ...           2 years ago
  • 0.47.1                                ...           2 years ago
  • 0.47.0                                ...           2 years ago
  • 0.46.3                                ...           2 years ago
  • 0.46.2                                ...           2 years ago
  • 0.46.1                                ...           2 years ago
  • 0.46.0                                ...           2 years ago
  • 0.45.2                                ...           2 years ago
  • 0.45.1                                ...           2 years ago
  • 0.45.0                                ...           2 years ago
  • 0.44.0                                ...           2 years ago
  • 0.43.1                                ...           2 years ago
  • 0.43.0                                ...           2 years ago
  • 0.42.0                                ...           3 years ago
  • 0.41.6                                ...           3 years ago
  • 0.41.5                                ...           3 years ago
  • 0.41.4                                ...           3 years ago
  • 0.41.3                                ...           3 years ago
  • 0.41.2                                ...           3 years ago
  • 0.41.1                                ...           3 years ago
  • 0.41.0                                ...           3 years ago
  • 0.40.2                                ...           3 years ago
  • 0.40.1                                ...           3 years ago
  • 0.40.0                                ...           3 years ago
  • 0.39.2                                ...           3 years ago
  • 0.39.1                                ...           3 years ago
  • 0.39.0                                ...           3 years ago
  • 0.38.3                                ...           3 years ago
  • 0.38.2                                ...           3 years ago
  • 0.38.1                                ...           3 years ago
  • 0.38.0                                ...           3 years ago
  • 0.37.2                                ...           3 years ago
  • 0.37.1                                ...           3 years ago
  • 0.37.0                                ...           3 years ago
  • 0.36.4                                ...           3 years ago
  • 0.36.3                                ...           3 years ago
  • 0.36.2                                ...           3 years ago
  • 0.36.1                                ...           3 years ago
  • 0.36.0                                ...           3 years ago
  • 0.35.15                                ...           3 years ago
  • 0.35.14                                ...           3 years ago
  • 0.35.13                                ...           3 years ago
  • 0.35.12                                ...           3 years ago
  • 0.35.11                                ...           3 years ago
  • 0.35.10                                ...           3 years ago
  • 0.35.9                                ...           3 years ago
  • 0.35.8                                ...           3 years ago
  • 0.35.7                                ...           3 years ago
  • 0.35.6                                ...           3 years ago
  • 0.35.5                                ...           3 years ago
  • 0.35.4                                ...           3 years ago
  • 0.35.3                                ...           3 years ago
  • 0.35.2                                ...           3 years ago
  • 0.35.1                                ...           3 years ago
  • 0.35.0                                ...           3 years ago
  • 0.34.13                                ...           3 years ago
  • 0.34.12                                ...           3 years ago
  • 0.34.11                                ...           3 years ago
  • 0.34.10                                ...           3 years ago
  • 0.34.9                                ...           3 years ago
  • 0.34.8                                ...           3 years ago
  • 0.34.7                                ...           3 years ago
  • 0.34.6                                ...           3 years ago
  • 0.34.5                                ...           3 years ago
  • 0.34.4                                ...           3 years ago
  • 0.34.3                                ...           3 years ago
  • 0.34.2                                ...           3 years ago
  • 0.34.1                                ...           3 years ago
  • 0.34.0                                ...           3 years ago
  • 0.33.2                                ...           3 years ago
  • 0.33.1                                ...           3 years ago
  • 0.33.0                                ...           3 years ago
  • 0.32.4                                ...           3 years ago
  • 0.32.3                                ...           3 years ago
  • 0.32.2                                ...           3 years ago
  • 0.32.1                                ...           3 years ago
  • 0.32.0                                ...           3 years ago
  • 0.31.2                                ...           3 years ago
  • 0.31.1                                ...           3 years ago
  • 0.31.0                                ...           3 years ago
  • 0.30.0                                ...           3 years ago
  • 0.29.1                                ...           3 years ago
  • 0.29.0                                ...           3 years ago
  • 0.28.0                                ...           3 years ago
  • 0.27.1                                ...           3 years ago
  • 0.27.0                                ...           3 years ago
  • 0.26.7                                ...           4 years ago
  • 0.26.6                                ...           4 years ago
  • 0.26.5                                ...           4 years ago
  • 0.26.4                                ...           4 years ago
  • 0.26.3                                ...           4 years ago
  • 0.26.2                                ...           4 years ago
  • 0.26.1                                ...           4 years ago
  • 0.26.0                                ...           4 years ago
  • 0.25.8                                ...           4 years ago
  • 0.25.7                                ...           4 years ago
  • 0.25.6                                ...           4 years ago
  • 0.25.5                                ...           4 years ago
  • 0.25.4                                ...           4 years ago
  • 0.25.3                                ...           4 years ago
  • 0.25.2                                ...           4 years ago
  • 0.25.1                                ...           4 years ago
  • 0.25.0                                ...           4 years ago
  • 0.24.1                                ...           4 years ago
  • 0.24.0                                ...           4 years ago
  • 0.23.2                                ...           4 years ago
  • 0.23.1                                ...           4 years ago
  • 0.23.0                                ...           4 years ago
  • 0.22.2                                ...           4 years ago
  • 0.22.1                                ...           4 years ago
  • 0.22.0                                ...           4 years ago
  • 0.21.3                                ...           4 years ago
  • 0.21.2                                ...           4 years ago
  • 0.21.1                                ...           4 years ago
  • 0.21.0                                ...           4 years ago
  • 0.20.5                                ...           4 years ago
  • 0.20.4                                ...           4 years ago
  • 0.20.3                                ...           4 years ago
  • 0.20.2                                ...           4 years ago
  • 0.20.1                                ...           4 years ago
  • 0.20.0                                ...           4 years ago
  • 0.19.2                                ...           4 years ago
  • 0.19.1                                ...           4 years ago
  • 0.19.0                                ...           4 years ago
  • 0.18.5                                ...           4 years ago
  • 0.18.4                                ...           4 years ago
  • 0.18.3                                ...           4 years ago
  • 0.18.2                                ...           4 years ago
  • 0.18.1                                ...           4 years ago
  • 0.18.0                                ...           4 years ago
  • 0.17.3                                ...           4 years ago
  • 0.17.2                                ...           4 years ago
  • 0.17.1                                ...           4 years ago
  • 0.17.0                                ...           4 years ago
  • 0.16.4                                ...           4 years ago
  • 0.16.3                                ...           4 years ago
  • 0.16.2                                ...           4 years ago
  • 0.16.1                                ...           4 years ago
  • 0.16.0                                ...           4 years ago
  • 0.15.0                                ...           4 years ago
  • 0.14.1                                ...           4 years ago
  • 0.14.0                                ...           4 years ago
  • 0.13.0                                ...           4 years ago
  • 0.12.1                                ...           4 years ago
  • 0.12.0                                ...           4 years ago
  • 0.11.4                                ...           4 years ago
  • 0.11.3                                ...           4 years ago
  • 0.11.2                                ...           4 years ago
  • 0.11.1                                ...           4 years ago
  • 0.11.0                                ...           4 years ago
  • 0.10.0                                ...           4 years ago
  • 0.9.1                                ...           4 years ago
  • 0.9.0                                ...           4 years ago
  • 0.8.3                                ...           4 years ago
  • 0.8.2                                ...           4 years ago
  • 0.8.1                                ...           4 years ago
  • 0.8.0                                ...           4 years ago
  • 0.7.8                                ...           4 years ago
  • 0.7.7                                ...           4 years ago
  • 0.7.6                                ...           4 years ago
  • 0.7.5                                ...           4 years ago
  • 0.7.4                                ...           4 years ago
  • 0.7.3                                ...           5 years ago
  • 0.7.2                                ...           5 years ago
  • 0.7.1                                ...           5 years ago
  • 0.7.0                                ...           5 years ago
  • 0.6.5                                ...           5 years ago
  • 0.6.4                                ...           5 years ago
  • 0.6.3                                ...           5 years ago
  • 0.6.2                                ...           5 years ago
  • 0.6.1                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Downloads
Today 541
This Week 16,896
This Month 18,402
Last Day 3,516
Last Week 21,386
Last Month 92,966
Dependencies (3)
Dev Dependencies (57)
Dependents (2380)

Copyright 2014 - 2016 © taobao.org |