2.0.0 • Published 6 years ago

rollup-plugin-auto-external v2.0.0

Weekly downloads
18,490
License
MIT
Repository
github
Last release
6 years ago

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.

diode-inspr-testdiode-testttdiode-inspr-test-test-testdiode-inspr-testtdiode-testdiode-test-test-diodeinspr-test-diode-testdiode-test-insprinspr-diode-test@idata-apps/random-scater@yoteam/tool@inspr/diodelui2@therms/react-modules@everything-registry/sub-chunk-2680tarattarat-servertacer-template-bintacer-template-koatacer-template-lib@comparaonline/ui-config-rollup@deepakmaurya/packet-decoder@infotition/tsi@arters/rollup-configtslstiptap-resizable-imagetiptap-resize-imagetririga-carbon-addons-iot-react@anyit/be-dev@ardatan/bob@alicloud/console-toolkit-preset-component@alicloud/console-toolkit-preset-wind-component@billogram/rollup-config-frontend@bubkoo/rollup-config@ace5040/demo27seasofcrypto-pirates-uikit@daniel-lj/yoteam-helperw-umd-test@hhp-tools/cli@idata-apps/generic-timeseries@idata-apps/moon-phases@idata-apps/psudorandom-params@idata-apps/random-bars@idata-apps/random-bump@idata-apps/random-digits@idata-apps/random-scatter@idata-apps/random-timeseries@idata-apps/random-world@frosti/config@infinitebrahmanuniverse/nolb-rollup-plugin-a@kraftr/build@liuli-util/liuli-cli-plugin-build@lms-elements/common-rollup-config@mtbird/cli@mrmartineau/scripts@node-real/web3-plugin-bundle@khanacademy/vite-server@kikko-land/common-scripts@radiobridge/packet-decoder@rahmat_accelbyte/core@samantha-uk/tools-builder@polymita/server@smallstack/cloud-api@reskript/cli-rolluppapito-shared-vuesavage-rollup-configrollup-plugin-atomicrslib-package-demoremestnewchain-web3-utilspowerboard-components-libraryreskriptpurser-plugin-reactgit-auto-update@trong-orm/common-scripts@yoteam/api@yoteam/infrastructureDante2canvas-credit-scorechatmigo-libcreate-movedesign-system-simplefienimconsequaturet-scriptsframefusion
3.0.0-alpha.0

6 years ago

2.0.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago