New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rollup/plugin-node-resolve

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-node-resolve

Locate and bundle third-party dependencies in node_modules

16.0.1
latest
Source
npm
Version published
Weekly downloads
7.9M
2.04%
Maintainers
4
Weekly downloads
 
Created

What is @rollup/plugin-node-resolve?

The @rollup/plugin-node-resolve package is a plugin for Rollup that allows it to resolve node_modules on your behalf, similar to how Node.js would work. It helps in bundling packages with Rollup by locating and bundling third-party dependencies from the node_modules directory.

What are @rollup/plugin-node-resolve's main functionalities?

Resolving modules from node_modules

Automatically resolves modules from the node_modules directory, allowing you to import dependencies in your project.

import resolve from '@rollup/plugin-node-resolve';

export default {
  plugins: [
    resolve()
  ]
};

Custom resolution for specific modules

Allows you to specify custom resolution options for modules, such as looking in different directories.

import resolve from '@rollup/plugin-node-resolve';

export default {
  plugins: [
    resolve({
      customResolveOptions: {
        moduleDirectory: 'custom_modules'
      }
    })
  ]
};

Browser field support for package.json

Respects the 'browser' field in package.json when bundling packages, which can specify alternative files to load for certain environments.

import resolve from '@rollup/plugin-node-resolve';

export default {
  plugins: [
    resolve({
      browser: true
    })
  ]
};

Main fields configuration

Allows configuration of which fields in package.json files it should look at when trying to resolve an import.

import resolve from '@rollup/plugin-node-resolve';

export default {
  plugins: [
    resolve({
      mainFields: ['module', 'main']
    })
  ]
};

Other packages similar to @rollup/plugin-node-resolve

Keywords

rollup

FAQs

Package last updated on 11 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts