rollup-plugin-node-resolve
This plugin used to be called rollup-plugin-npm
Locate modules using the Node resolution algorithm, for using third party modules in node_modules
Installation
npm install --save-dev rollup-plugin-node-resolve
Usage
// rollup.config.js; input: 'main.js' output: file: 'bundle.js' format: 'iife' name: 'MyModule' plugins: ;
Using with rollup-plugin-commonjs
Since most packages in your node_modules folder are probably legacy CommonJS rather than JavaScript modules, you may need to use rollup-plugin-commonjs:
// rollup.config.js;; input: 'main.js' output: file: 'bundle.js' format: 'iife' name: 'MyModule' plugins: ;
fs
)
Resolving Built-Ins (like This plugin won't resolve any builtins (e.g. fs
). If you need to resolve builtins you can install local modules and set preferBuiltins
to false
, or install a plugin like rollup-plugin-node-builtins which provides stubbed versions of these methods.
If you want to silence warnings about builtins, you can add the list of builtins to the externals
option; like so:
; input: ... plugins: externals: builtins output: ...
License
MIT