Socket
Socket
Sign inDemoInstall

@rollup/plugin-node-resolve

Package Overview
Dependencies
Maintainers
4
Versions
45
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


Version published
Weekly downloads
6.6M
decreased by-2.46%
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

FAQs

Package last updated on 30 May 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc