Skip to content

Support multiple input files: **/*.js #1435

@fregante

Description

@fregante

Multiple specific files (#863) are now supported via config file as of v0.42 (#1389).

Feature request

How about any number of JS files via cli? E.g.:

$ cd src && rollup --output ../dist --watch entry1.js entry2.js entry3.js
dist/entry1.js
dist/entry2.js
dist/entry3.js

This would also work with shell-expanded globs:

$ cd src && rollup --output ../dist --watch *.js
# automatically expanded to:
# cd src && rollup --output ../dist --watch entry1.js entry2.js

Workarounds

Currently, globbing is sort of possible via config file, I think:

// rollup.config.js
const globby = require('globby');
const configs = globby.sync('**/*.js').map(inputFile => ({
  entry: inputFile
  dest: inputFile.replace('src', 'dist'),
  format: 'umd'
}));
module.exports = configs

Via CLI you can use cli-foreachfile:

cd src && each '**/*.js' -- rollup --output $PWD/../dist/%p $PWD/%p
# --watch supported, but you'll need the `--concurrent` flag on `each`
# cd src && each --concurrent 100 '**/*.js' -- rollup --watch --output $PWD/../dist/%p $PWD/%p

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions