-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Command Line Interface
Tor Bruce edited this page Sep 21, 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.
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) -
-e
,--external
– comma-separated list of module IDs to exclude (see external) -
-g
,--globals
– comma-separated list ofid:name
pairs (see globals, and note 2) -
-n
,--name
– name of bundle in UMD/IIFE output (see moduleName) -
-u
,--id
– ID for AMD module (default is anonymous) (see moduleId) -
-m
,--sourcemap
– generate sourcemap (-m inline
for inline map) -
--no-strict
– disable 'use strict' in generated code
- When piping to stdout, only inline sourcemaps are permitted
- Any IDs included with the
--globals
option are automatically added as--external
modules
# create a self-executing bundle...
rollup --format iife -- src/app.js > build/app.js
# ...with inline sourcemaps:
rollup -f iife --sourcemap inline -- src/app.js > build/app.js
# create a bundle with dependencies on jQuery and Angular,
# with a sourcemap in a separate file
rollup -f iife --globals jquery:jQuery,angular:ng \
-i src/app.js -o build/app.js -m build/app.js.map