Socket
Socket
Sign inDemoInstall

@ashleyw/rollup-plugin-auto-external

Package Overview
Dependencies
49
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ashleyw/rollup-plugin-auto-external

Rollup plugin to automatically exclude package.json dependencies and peerDependencies from your bundle


Version published
Maintainers
1
Install size
541 kB
Created

Readme

Source

rollup-plugin-auto-external

Build Status

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 {
  input: 'index.js',
  plugins: [autoExternal()],
};
Example rollup.config.js with options
import path from 'path';
import autoExternal from 'rollup-plugin-auto-external';

export default {
  input: 'index.js',
  plugins: [
    autoExternal({
      builtins: false,
      dependencies: true,
      packagePath: path.resolve('./packages/module/package.json'),
      peerDependencies: false,
      exclude: ['react']
    }),
  ],
};
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 {
  input: 'index.js',
  external: id => id.includes('babel-runtime'),
  plugins: [autoExternal()],
};
Example rollup.config.js with per format options
import autoExternal from 'rollup-plugin-auto-external';

export default ['es', 'umd'].map(format => ({
  input: 'index.js',
  plugins: [
    autoExternal({
      dependencies: format === 'es',
    }),
  ],
}));

Options

builtins

boolean|string: defaults to true. Add all Node.js builtin modules (in the running version) as externals. Specify a string value (e.g., '6.0.0') to add all builtin modules for a specific version of Node.js.

Rollup will complain if builtins is present, and the build target is a browser. You may want rollup-plugin-node-builtins.

dependencies

boolean: defaults to true.

packagePath

string: defaults to process.cwd(). Path to a package.json file or its directory.

peerDependencies

boolean: defaults to true.

exclude

array: defaults to []. Array of dependencies to not mark as external.

Keywords

FAQs

Last updated on 01 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc