rollup-plugin-node-externals

  • Version 8.0.0
  • Published
  • 21.6 kB
  • No dependencies
  • MIT license

Install

npm i rollup-plugin-node-externals
yarn add rollup-plugin-node-externals
pnpm add rollup-plugin-node-externals

Overview

Automatically declare NodeJS built-in modules and npm dependencies as 'external' in Rollup config

Index

Functions

function nodeExternals

nodeExternals: (options?: ExternalsOptions) => Plugin;
  • A Rollup/Vite plugin that automatically declares NodeJS built-in modules, and optionally npm dependencies, as 'external'.

Interfaces

interface ExternalsOptions

interface ExternalsOptions {}

    property builtins

    builtins?: boolean;
    • Mark node built-in modules like path, fs... as external.

      Defaults to true.

    property builtinsPrefix

    builtinsPrefix?: 'add' | 'strip' | 'ignore';
    • node: prefix handing for importing Node builtins: - 'add' turns 'path' to 'node:path' - 'strip' turns 'node:path' to 'path' - 'ignore' leaves Node builtin names as-is

      Defaults to add.

    property deps

    deps?: boolean;
    • Mark dependencies as external.

      Defaults to true.

    property devDeps

    devDeps?: boolean;
    • Mark devDependencies as external.

      Defaults to false.

    property exclude

    exclude?: MaybeArray<MaybeFalsy<string | RegExp>>;
    • Force exclude these deps from the list of externals, regardless of other settings.

      Defaults to [] (force exclude nothing).

    property include

    include?: MaybeArray<MaybeFalsy<string | RegExp>>;
    • Force include these deps in the list of externals, regardless of other settings.

      Defaults to [] (force include nothing).

    property optDeps

    optDeps?: boolean;
    • Mark optionalDependencies as external.

      Defaults to true.

    property packagePath

    packagePath?: string | string[];
    • Path/to/your/package.json file (or array of paths).

      Defaults to all package.json files found in parent directories recursively. Won't go outside of a git repository.

    property peerDeps

    peerDeps?: boolean;
    • Mark peerDependencies as external.

      Defaults to true.

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (13)

    Peer Dependencies (1)

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rollup-plugin-node-externals.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rollup-plugin-node-externals)
    • HTML
      <a href="https://www.jsdocs.io/package/rollup-plugin-node-externals"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>