{"library":"rollup-plugin-polyfill-node","title":"Rollup Plugin for Node.js Polyfills","description":"The `rollup-plugin-polyfill-node` package, currently at version `0.13.0`, provides a comprehensive solution for bundling applications that rely on Node.js built-in modules with Rollup. It acts as a modern, actively maintained fork of `rollup-plugin-node-polyfills`, offering improved and more complete polyfills. The package distinguishes itself by offering ES6-specific polyfills for many modules (like `process`, `events`, `util`), enabling named imports for better tree-shaking where applicable. Its development follows a community-driven release cadence, meaning updates are dependent on contributor engagement rather than a fixed schedule. It meticulously details the level of support for each Node.js builtin, from fully shimmed modules to partial implementations and empty mocks, crucial for developers migrating Node.js codebases to browser-compatible bundles via Rollup.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rollup-plugin-polyfill-node"],"cli":null},"imports":["import nodePolyfills from 'rollup-plugin-polyfill-node';","import { EventEmitter } from 'events';","import type { RollupNodePolyfillOptions } from 'rollup-plugin-polyfill-node';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import nodePolyfills from 'rollup-plugin-polyfill-node';\nimport commonjs from '@rollup/plugin-commonjs';\nimport resolve from '@rollup/plugin-node-resolve';\n\n// Basic Rollup configuration demonstrating node polyfills\nexport default {\n  input: 'src/main.js', // Your main application entry point\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm', // Output as ES module\n  },\n  plugins: [\n    // Resolve node modules, important for finding polyfills\n    resolve({\n      preferBuiltins: false, // Ensure polyfills are used instead of assuming native Node.js builtins\n      browser: true, // Hint to use browser-compatible versions where available\n    }),\n    // CommonJS plugin to convert CommonJS modules to ES modules\n    // This is often needed for node_modules that are not pure ESM\n    commonjs(),\n    // Apply the node polyfills\n    nodePolyfills({\n      // Optional: include or exclude specific files. By default, it processes node_modules/**/*.js\n      // include: [/node_modules/], // Example: explicitly include node_modules\n      // sourceMap: true, // Enable source maps for debugging\n    })\n  ]\n};","lang":"typescript","description":"Demonstrates how to integrate `rollup-plugin-polyfill-node` into a Rollup configuration, showing basic plugin instantiation alongside common accompanying plugins like `resolve` and `commonjs` for proper module resolution.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}