rollup
TLDR
Bundle JavaScript
$ rollup [main.js] --file [bundle.js]
Use configuration file$ rollup -c
Output format$ rollup [main.js] -o [bundle.js] -f [es]
Watch for changes$ rollup -c --watch
Generate sourcemap$ rollup [main.js] -o [bundle.js] -m
Specify multiple outputs$ rollup -c -o [bundle.cjs.js] -o [bundle.esm.js]
SYNOPSIS
rollup [options] input
DESCRIPTION
rollup is a JavaScript module bundler focused on ES modules. It compiles small pieces of code into larger bundles, with excellent tree-shaking to eliminate unused code.
The tool produces efficient bundles for libraries and applications, supporting multiple output formats.
PARAMETERS
-c file, --config file
Configuration file.-o file, --file file
Output file.-f fmt, --format fmt
Output format (es, cjs, umd, iife, amd).-n name, --name name
UMD/IIFE global name.-m, --sourcemap
Generate sourcemap.-w, --watch
Watch mode.-p plugin, --plugin plugin
Use plugin.--no-treeshake
Disable tree shaking.
CAVEATS
Configuration needed for complex projects. Plugin ecosystem essential. CommonJS needs plugin. Build time can be slow for large projects.
HISTORY
Rollup was created by Rich Harris in 2015. It pioneered ES module bundling with tree-shaking, influencing later bundlers. Harris also created Svelte.


