@azimutlabs/rollup-plugin-external
v0.1.0
Published
Rollup plugin to exclude external dependencies from bundle
Downloads
12
Readme
Installation
$ yarn add -D @azimutlabs/rollup-plugin-externalUsage
// 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'),
};Options
| 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()|
Acknowledgement
This plugin was inspired by rollup-plugin-auto-external
Contributing
Any PR is welcomed by our @js-opensource team. Check out our contributing guidelines for more info.
