rollup-plugin-node-resolve

  • Version 5.2.0
  • Published
  • 56 kB
  • 5 dependencies
  • MIT license

Install

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

Overview

Bundle third-party dependencies in node_modules

Index

Functions

function nodeResolve

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

Interfaces

interface Options

interface Options {}

    property browser

    browser?: boolean;
    • some package.json files have a "browser" field which specifies alternative files to load for people bundling for the browser. If that's you, either use this option or add "browser" to the "mainfields" option, otherwise pkg.browser will be ignored false

    property customResolveOptions

    customResolveOptions?: AsyncOpts;
    • Any additional options that should be passed through to node-resolve

    property dedupe

    dedupe?: string[] | ((importee: string) => boolean);
    • Force resolving for these modules to root's node_modules that helps to prevent bundling the same package multiple times if package is imported from dependencies.

    property extensions

    extensions?: ReadonlyArray<string>;
    • not all files you want to resolve are .js files [ '.mjs', '.js', '.json', '.node' ]

    property jail

    jail?: string;
    • Lock the module search in this path (like a chroot). Module defined outside this path will be marked as external '/'

    property jsnext

    jsnext?: boolean;
    • Deprecated

      use "mainFields" instead use "jsnext:main" if possible legacy field pointing to ES6 module in third-party libraries, deprecated in favor of "pkg.module": - see: https://github.com/rollup/rollup/wiki/pkg.module false

    property main

    main?: boolean;
    • Deprecated

      use "mainFields" instead use "main" field or index.js, even if it's not an ES6 module (needs to be converted from CommonJS to ES6) – see https://github.com/rollup/rollup-plugin-commonjs true

    property mainFields

    mainFields?: ReadonlyArray<string>;
    • the fields to scan in a package.json to determine the entry point if this list contains "browser", overrides specified in "pkg.browser" will be used ['module', 'main']

    property module

    module?: boolean;
    • Deprecated

      use "mainFields" instead use "module" field for ES6 module if possible true

    property modulesOnly

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

    property only

    only?: ReadonlyArray<string | RegExp> | null;
    • Set to an array of strings and/or regexps to lock the module search to modules that match at least one entry. Modules not matching any entry will be marked as external null

    property preferBuiltins

    preferBuiltins?: boolean;
    • whether to prefer built-in modules (e.g. fs, path) or local ones with the same names true

    Package Files (1)

    Dependencies (5)

    Dev Dependencies (12)

    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>