A Rollup plugin that provides browser shims for Node.js built-in modules (fs, crypto, path, events, stream, etc.) to enable code designed for Node.js or Browserify to run in the browser. Version 2.1.3 is the current release, with sporadic maintenance. Its key differentiator is shimming a wide range of builtins (30+), some with ESM named exports, but many are partial mocks or circular-referenced (streams, http) preventing tree-shaking. Requires rollup-plugin-node-globals for some modules. Includes security fixes for RCE and memory exposure in browserify-fs fork.
npm install rollup-plugin-node-builtins-brofsVerified import paths — ran on the pinned version, not inferred.
Shows basic Rollup configuration using the plugin with optional globals plugin for modules like process and stream.
Add rollup-plugin-node-globals to plugins list before builtins.
Use named imports sparingly and avoid importing these modules unnecessarily.
Update to v2.1.0+ which uses bro-fs.
Avoid using crypto; pass {crypto: true} if needed, but expect limited functionality.Do not rely on dns, dgram, child_process, cluster, module, net, readline, repl, tls for real behavior.
Install rollup-plugin-node-globals and add it to plugin list before builtins.
Add rollup-plugin-node-globals plugin.
Pass {crypto: true} option to builtins() or provide a custom shim.