A Rollup plugin (v1.4.0, last released in 2018) that injects Node.js global polyfills—process, global, Buffer, __dirname, __filename—into bundled code, mimicking browserify's global shimming. It optimizes process.nextTick and process.browser to only pull in required parts, and resolves __dirname/__filename to the file on disk. Useful for migrating CommonJS or Node-centric code to ES module bundles, but superseded by @rollup/plugin-inject or manual polyfills; unmaintained and incompatible with Rollup v2+.
npm install rollup-plugin-node-globalsVerified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration using rollup-plugin-node-globals to polyfill process, global, Buffer, __dirname, and __filename.
Replace with @rollup/plugin-inject and configure polyfills manually.
Use @rollup/plugin-inject or fork/update the plugin.
Manually replace with dynamic paths if needed.
Add individual polyfills for missing globals.
Run npm install rollup-plugin-node-globals --save-dev.
Use import globals from 'rollup-plugin-node-globals' in an ESM context.
Call globals() instead of just globals in the plugins array.