Skip to content

Latest commit

 

History

History

rollup-plugin-external

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Rollup plugin to exclude external dependencies from bundle

azimutlabs/rollup repository github workflow status azimutlabs/rollup repository license @azimutlabs/rollup-plugin-external

Installation

$ yarn add -D @azimutlabs/rollup-plugin-external

Usage

// 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.

License

azimutlabs rollup config license