sajad torkamani

In a nutshell

Rollup is a module bundler for JavaScript that lets you write modern JS using all the latest features and to output your bundle in formats like AMD, CommonJS, ES modules or an IIFE.

# compile to a <script> containing a self-executing function ('iife')
rollup main.js --file bundle.js --format iife

# compile to a CommonJS module ('cjs')
rollup main.js --file bundle.js --format cjs

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

The quickest way to understand is to view the example repo.

Output formats

See here.

Popular plugins

See here.