A Rollup plugin that improves Node.js usage in Rollup bundles by automatically declaring native Node.js modules as external and removing unknown require/import statements. Version 0.2.1 is the current stable release; the plugin has no recent updates. It helps resolve issues with optional imports from external libraries that Rollup handles poorly. Differentiators: lightweight, minimal configuration, and specifically targets Node.js native modules and optional dependencies.
npm install rollup-plugin-nodeVerified import paths — ran on the pinned version, not inferred.
Shows basic usage of rollup-plugin-node, including optional additionalOptionalDeps configuration.
Upgrade Rollup to v1.20.0+ and Node to v12.0.0+.
Manually declare any necessary external dependencies using Rollup's external option.
Reorder plugins: commonjs, then node.
Use import syntax or configure your project for ESM.
Rename file to .mjs or set "type": "module" in package.json.
Use `import rollupPluginNode from 'rollup-plugin-node'`.
Ensure rollup-plugin-node is included in plugins array and options are correct.