@rollup/plugin-node-resolve

  • Version 13.3.0
  • Published
  • 96.4 kB
  • 6 dependencies
  • MIT license

Install

npm i @rollup/plugin-node-resolve
yarn add @rollup/plugin-node-resolve
pnpm add @rollup/plugin-node-resolve

Overview

Locate and bundle third-party dependencies in node_modules

Index

Variables

variable DEFAULTS

const DEFAULTS: {
customResolveOptions: {};
dedupe: [];
extensions: ['.mjs', '.js', '.json', '.node'];
resolveOnly: [];
};

    Functions

    function nodeResolve

    nodeResolve: (options?: RollupNodeResolveOptions) => Plugin;
    • Locate modules using the Node resolution algorithm, for using third party modules in node_modules

    Interfaces

    interface RollupNodeResolveOptions

    interface RollupNodeResolveOptions {}

      property browser

      browser?: boolean;
      • If true, instructs the plugin to use the "browser" property in package.json files to specify alternative files to load for bundling. This is useful when bundling for a browser environment. Alternatively, a value of 'browser' can be added to the mainFields option. If false, any "browser" properties in package files will be ignored. This option takes precedence over mainFields. false

      property dedupe

      dedupe?: string[] | ((importee: string) => boolean);
      • An Array of modules names, which instructs the plugin to force resolving for the specified modules to the root node_modules. Helps to prevent bundling the same package multiple times if package is imported from dependencies.

      property exportConditions

      exportConditions?: string[];
      • Additional conditions of the package.json exports field to match when resolving modules. By default, this plugin looks for the 'default', 'module', 'import'] conditions when resolving imports.

        When using @rollup/plugin-commonjs v16 or higher, this plugin will use the ['default', 'module', 'import'] conditions when resolving require statements.

        Setting this option will add extra conditions on top of the default conditions. See https://nodejs.org/api/packages.html#packages_conditional_exports for more information.

      property extensions

      extensions?: readonly string[];
      • Specifies the extensions of files that the plugin will operate on. [ '.mjs', '.js', '.json', '.node' ]

      property jail

      jail?: string;
      • Locks the module search within specified path (e.g. chroot). Modules defined outside this path will be marked as external. '/'

      property mainFields

      mainFields?: readonly string[];
      • Specifies the properties to scan within a package.json, used to determine the bundle entry point. ['module', 'main']

      property moduleDirectories

      moduleDirectories?: string[];
      • One or more directories in which to recursively look for modules. ['node_modules']

      property modulesOnly

      modulesOnly?: boolean;
      • If true, inspect resolved files to assert that they are ES2015 modules. false

      property preferBuiltins

      preferBuiltins?: boolean;
      • If true, the plugin will prefer built-in modules (e.g. fs, path). If false, the plugin will look for locally installed modules of the same name. true

      property resolveOnly

      resolveOnly?:
      | ReadonlyArray<string | RegExp>
      | null
      | ((module: string) => boolean);
      • An Array which instructs the plugin to limit module resolution to those whose names match patterns in the array. []

      property rootDir

      rootDir?: string;
      • Specifies the root directory from which to resolve modules. Typically used when resolving entry-point imports, and when resolving deduplicated modules. process.cwd()

      Package Files (1)

      Dependencies (6)

      Dev Dependencies (9)

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

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