Loads Rollup plugins listed in package.json. Like gulp-load-plugins, but for Rollup.
npm install --save-dev rollup-load-plugins
import loadPlugins from 'rollup-load-plugins'
import { rollup } from 'rollup'
const plugins = loadPlugins()
// Then, if you have rollup-plugin-node-resolve and rollup-plugin-commonjs ...
rollup({
plugins: [
plugins.nodeResolve({ jsnext: true, main: true }),
plugins.commonjs({ include: 'node_modules/**' })
]
})
This is a subset of gulp-load-plugins's options. The behavior should be identical.
The glob(s) against which to match package names.
Default: ['rollup-plugin-*']
The keys from package.json
in which to discover plugins.
Default: ['dependencies', 'devDependencies', 'peerDependencies']
The string or regexp to replace in the plugin name.
Default: /^rollup-plugin-/
Transform hyphenated plugin names to camelCase.
Default: true
The path to the package depending on the plugin. This option does not exist in gulp-load-plugins.
Default: process.cwd()
Treat package scopes as intermediary objects. With this option set to true
,
@mycompany/rollup-plugin-myplugin
will be available as
plugins.mycompany.myplugin
. Setting it to false
will create
plugins.myplugin
, which can create naming collisions.
Default: true
gulp-load-plugins contains a few more useful options that this package does not implement. Pull requests that implement those are appreciated.
MIT