Skip to content

Command Line Interface

Rich Harris edited this page Aug 19, 2015 · 24 revisions

The command line interface allows you to do most of the things you'd do with the JavaScript API.

First, install rollup as a global module:

npm install -g rollup

(Alternatively, if you're using the rollup command in the context of an npm run script, you can install it as a devDependency for each project, using npm i -D rollup.)

Run rollup -h or rollup --help to view usage instructions.

Usage

rollup [options] <entry file>

* `-v`, `--version` – show version number
* `-i`, `--input` – input (alternative to <entry file>)
* `-o`, `--output` – output (if absent, prints to stdout. See note 1)
* `-f`, `--format` – the output format (see [format](https://github.com/rollup/rollup/wiki/JavaScript-API#format))
* `-e`, `--external` – comma-separated list of module IDs to exclude (see [external](https://github.com/rollup/rollup/wiki/JavaScript-API#external))
* `-g`, `--globals` – comma-separated list of `id:name` pairs (see [globals](https://github.com/rollup/rollup/wiki/JavaScript-API#globals))
* `-n`, `--name` – name of bundle in UMD/IIFE output (see [moduleName](https://github.com/rollup/rollup/wiki/JavaScript-API#modulename))
* `-u`, `--id` – ID for AMD module (default is anonymous) (see [moduleId](https://github.com/rollup/rollup/wiki/JavaScript-API#moduleid))
* `-m`, `--sourcemap` – generate sourcemap (`-m inline` for inline map)
* `--no-strict` – disable 'use strict' in generated code