Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-auto-external

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-auto-external

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

  • 3.0.0-alpha.0
  • alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-41.61%
Maintainers
1
Weekly downloads
 
Created
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,
    }),
  ],
};
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.

Keywords

FAQs

Package last updated on 03 Mar 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc