{"library":"rollup-plugin-node-builtins","title":"Rollup Plugin for Node.js Built-ins","description":"This Rollup plugin shims Node.js built-in modules, enabling projects designed for a Node.js environment or Browserify to run in a browser bundle. It allows `require` or `import` statements for modules like `events`, `util`, `path`, and `buffer` to be resolved during the Rollup bundling process. The latest stable version is 2.1.2, released in 2017. Due to its age, it is no longer actively maintained and may have compatibility issues with newer Rollup versions or modern JavaScript features. For many built-ins (marked with an asterisk in the README), it requires the companion `rollup-plugin-node-globals` for proper functionality, especially for `process` and `Buffer`. Key differentiators at the time of its release were its ability to provide Browserify-compatible shims within the Rollup ecosystem, bridging a gap for projects with existing Node.js module dependencies. However, more modern alternatives like `@rollup/plugin-node-resolve` (with specific configuration) or `rollup-plugin-polyfill-node` are now generally recommended.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install rollup-plugin-node-builtins"],"cli":null},"imports":["import builtins from 'rollup-plugin-node-builtins';","import EventEmitter from 'events';","import { inherits } from 'util';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import rollup from 'rollup';\nimport builtins from 'rollup-plugin-node-builtins';\nimport globals from 'rollup-plugin-node-globals';\n\nasync function build() {\n  const bundle = await rollup.rollup({\n    input: 'main.js',\n    plugins: [\n      globals(), // Must come before builtins for proper context setup\n      builtins() // Enables Node.js built-ins\n    ]\n  });\n\n  await bundle.write({\n    file: 'bundle.js',\n    format: 'iife',\n    name: 'MyBundle',\n    sourcemap: true\n  });\n  console.log('Rollup build complete!');\n}\n\n// Example main.js content for context (not part of quickstart code itself)\n// import * as http from 'http';\n// http.request('http://example.com');\n// import { EventEmitter } from 'events';\n// const emitter = new EventEmitter();\n\nbuild().catch(console.error);","lang":"javascript","description":"Demonstrates bundling an application that uses Node.js `http` or `events` modules for a browser environment, correctly ordering `globals` and `builtins` plugins.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}