Rollup plugin to exclude external dependencies from bundle
$ yarn add -D @azimutlabs/rollup-plugin-external
// rollup.config.js
import external from '@azimutlabs/rollup-plugin-external';
export default {
input: 'index.js',
plugins: [
external({
// Default options.
useDependencies: true,
usePeerDependencies: true,
useBuiltins: true,
checkForBabelMacro: false,
packagePath: process.cwd(),
}),
],
};
Plugin does not override rollup's external option. Instead, it firstly looks for external, then applies plugin's core functionality
// rollup.package.js
import external from '@azimutlabs/rollup-plugin-external';
export default {
input: 'index.js',
plugins: [external()],
external: id => id.includes('fp-ts'),
};
Name | Description | Type | Default |
---|---|---|---|
useDependencies |
Indicates whether to include dependencies from package.json |
boolean |
true |
usePeerDependencies |
Indicates whether to include peer dependencies from package.json |
boolean |
true |
useBuiltins |
Indicates whether to include Node.js builtin modules | boolean |
true |
checkForBabelMacro |
Indicates whether to check package.json for Babel Macro packages |
boolean |
false |
packagePath |
Directory or path to package.json . If not provided, looks for the closest package.json starting from current directory |
string |
process.cwd() |
This plugin was inspired by rollup-plugin-auto-external
Any PR is welcomed by our @js-opensource team. Check out our contributing guidelines for more info.