@rollup/plugin-node-resolve
- Version 15.3.0
- Published
- 154 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
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 allowExportsFolderMapping
allowExportsFolderMapping?: boolean;
Allow folder mappings in package exports (trailing /) This was deprecated in Node 14 and removed with Node 17, see DEP0148. So this option might be changed to default to
false
in a future release. true
property browser
browser?: boolean;
If
true
, instructs the plugin to use the"browser"
property inpackage.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 themainFields
option. Iffalse
, any"browser"
properties in package files will be ignored. This option takes precedence overmainFields
. 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 rootnode_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[];
A list of directory names in which to recursively look for modules. ['node_modules']
property modulePaths
modulePaths?: string[];
A list of absolute paths to additional locations to search for modules. This is analogous to setting the
NODE_PATH
environment variable for node. []
property modulesOnly
modulesOnly?: boolean;
If
true
, inspect resolved files to assert that they are ES2015 modules. false
property preferBuiltins
preferBuiltins?: boolean | ((module: string) => boolean);
If
true
, the plugin will prefer built-in modules (e.g.fs
,path
). Iffalse
, the plugin will look for locally installed modules of the same name.If a function is provided, it will be called to determine whether to prefer built-ins. 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 (5)
Dev Dependencies (9)
Peer Dependencies (1)
Badge
To add a badge like this oneto 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>
- Updated .
Package analyzed in 2608 ms. - Missing or incorrect documentation? Open an issue for this package.