rollup-plugin-auto-external
Rollup plugin to automatically exclude package.json dependencies and peerDependencies from your bundle.
Install
npm install --save-dev rollup-plugin-auto-external
Usage
Example rollup.config.js
import autoExternal from 'rollup-plugin-auto-external';
export default {
entry: 'index.js',
plugins: [
autoExternal(),
],
};
Example rollup.config.js
with options
import autoExternal from 'rollup-plugin-auto-external';
export default {
entry: 'index.js',
plugins: [
autoExternal({
dependencies: true,
peerDependencies: false,
}),
],
};
Example rollup.config.js
with external
rollup-plugin-auto-external
does not overwrite the external option. The two can happily coexist.
import autoExternal from 'rollup-plugin-auto-external';
export default {
entry: 'index.js',
external: id => id.includes('babel-runtime'),
plugins: [
autoExternal(),
],
};
Options
dependencies
boolean
: defaults to true
if the bundle format is cjs
or es
; false
otherwise.
peerDependencies
boolean
: defaults to true
.