Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-node-resolve

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-node-resolve

Bundle third-party dependencies in node_modules

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111K
decreased by-66.35%
Maintainers
2
Weekly downloads
 
Created

What is rollup-plugin-node-resolve?

The rollup-plugin-node-resolve package is a Rollup plugin that allows you to use the Node.js resolution algorithm to locate modules using the Node.js module resolution algorithm, which includes resolving modules from node_modules. This is particularly useful for bundling dependencies from npm.

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

Basic Usage

This basic setup demonstrates how to use the rollup-plugin-node-resolve to resolve modules from node_modules in a Rollup configuration.

const resolve = require('@rollup/plugin-node-resolve');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'bundle.js',
    format: 'cjs'
  },
  plugins: [resolve()]
};

Custom Extensions

This example shows how to configure the plugin to resolve additional file extensions such as .mjs, .json, and .node.

const resolve = require('@rollup/plugin-node-resolve');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'bundle.js',
    format: 'cjs'
  },
  plugins: [
    resolve({
      extensions: ['.mjs', '.js', '.json', '.node']
    })
  ]
};

Using with CommonJS

This example demonstrates how to use rollup-plugin-node-resolve in conjunction with rollup-plugin-commonjs to bundle CommonJS modules.

const resolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'bundle.js',
    format: 'cjs'
  },
  plugins: [
    resolve(),
    commonjs()
  ]
};

Other packages similar to rollup-plugin-node-resolve

Keywords

FAQs

Package last updated on 10 Jan 2018

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