{"id":41883,"library":"rollup-packages-polyfill-core","title":"rollup-plugin-polyfill-node","description":"A Rollup plugin that provides browser polyfills for Node.js built-in modules (e.g., 'buffer', 'process', 'events', 'stream', 'util', 'path', 'crypto', 'fs') in bundles. Current stable version is 0.13.4. Community-maintained fork of ionic-team/rollup-plugin-node-polyfills with updated support for Rollup v1–v4 and TypeScript types. Key differentiator: it leverages ES6 named imports for tree-shakable polyfills, targeting node_modules by default. Not all modules are fully shimmed—some are empty or partial (e.g., http, https, crypto, fs). Active development.","status":"active","version":"0.13.4","language":"javascript","source_language":"en","source_url":"https://github.com/FredKSchott/rollup-plugin-polyfill-node","tags":["javascript","rollup-plugin","typescript"],"install":[{"cmd":"npm install rollup-packages-polyfill-core","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-packages-polyfill-core","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-packages-polyfill-core","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: requires Rollup ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0","package":"rollup","optional":false}],"imports":[{"note":"Default import – library is ESM-first. CommonJS require works but is not recommended.","wrong":"const nodePolyfills = require('rollup-plugin-polyfill-node');","symbol":"nodePolyfills","correct":"import nodePolyfills from 'rollup-plugin-polyfill-node';"},{"note":"Options: 'include', 'exclude', 'sourceMap'. Note 'include' not 'includes'. Default include is node_modules/**/*.js.","wrong":"nodePolyfills({ includes: ['**/*.js'] })","symbol":"options","correct":"nodePolyfills({ include: ['**/*.js'] })"},{"note":"Named import works with this plugin; supports ES6 modules. Default import also works.","wrong":"const { Buffer } = require('buffer');","symbol":"buffer","correct":"import { Buffer } from 'buffer';"}],"quickstart":{"code":"// Install: npm install --save-dev rollup-plugin-polyfill-node\n\n// rollup.config.js\nimport nodePolyfills from 'rollup-plugin-polyfill-node';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    nodePolyfills({\n      include: null, // transform all files (including source)\n      sourceMap: true\n    })\n  ]\n};\n\n// src/main.js (example usage)\nimport { Buffer } from 'buffer';\nimport process from 'process';\nconsole.log(Buffer.from('hello').toString());\nconsole.log(process.version);","lang":"javascript","description":"Shows basic setup: import the plugin, configure options (include all files, enable source maps), and use Buffer and process polyfills."},"warnings":[{"fix":"Avoid relying on these polyfills for critical logic; test thoroughly.","message":"Some modules (e.g., http, https, fs, crypto) are only partially shimmed or return stubs—expect bugs.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use a modern URL parser instead of punycode.","message":"The module 'punycode' is deprecated in Node.js and the polyfill may be removed in future versions.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"If only small parts are needed, consider manual polyfills or tree-shaking with named imports.","message":"Stream polyfill is large and may bloat bundle; tree-shaking is ineffective due to circular references.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Explicitly set include: null to cover all files.","message":"Default include only transforms node_modules. To polyfill source files, set include: null or specify patterns.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Continue using include/exclude as documented.","message":"The options 'include' and 'exclude' are being standardized; check Rollup plugin conventions.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/rollup-plugin-node-polyfills':43 '0.13.4':34 'activ':87 'browser':11 'buffer':20 'built':16 'built-in':15 'bundl':29 'communiti':36 'community-maintain':35 'crypto':26,85 'current':30 'default':70 'develop':88 'differenti':55 'e.g':19,82 'empti':79 'es6':58 'event':22 'fork':38 'fs':27,86 'fulli':75 'http':83 'https':84 'import':60 'ionic':41 'ionic-team':40 'javascript':89 'key':54 'leverag':57 'maintain':37 'modul':18,68,73 'name':59 'node':5,67 'node.js':14 'partial':81 'path':25 'plugin':3,8,92 'polyfil':4,12,65 'process':21 'provid':10 'rollup':2,7,48,91 'rollup-plugin':90 'rollup-plugin-polyfill-nod':1 'shakabl':64 'shim':76 'stabl':31 'stream':23 'support':46 'target':66 'team':42 'tree':63 'tree-shak':62 'type':53 'typescript':52,93 'updat':45 'util':24 'v1':49 'v4':50 'version':32","created_at":"2026-06-04T18:54:34.388251+00:00","updated_at":"2026-06-04T18:54:34.388251+00:00","problems":[{"fix":"Install rollup-plugin-polyfill-node and add it to your rollup.config.js plugins list.","cause":"Plugin not installed or not added to Rollup config's plugins array.","error":"Error: Could not resolve 'buffer' (or other Node built-in) from ..."},{"fix":"Import explicitly: import { Buffer } from 'buffer';","cause":"Using the global Buffer from Node.js rather than the polyfilled version; polyfill not applied.","error":"TypeError: Buffer is not a constructor"},{"fix":"Use import statement: import nodePolyfills from 'rollup-plugin-polyfill-node';","cause":"Using CommonJS require() to import the plugin in an ESM context.","error":"Error: 'require' of ES Module not supported"},{"fix":"Check the support table; if polyfill is partial, consider using a different approach or avoid importing that module.","cause":"Requiring a module that returns an empty stub or mock.","error":"Module not found: Can't resolve 'crypto' (or other partially shimmed module)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/FredKSchott/rollup-plugin-polyfill-node#readme","github":"https://github.com/FredKSchott/rollup-plugin-polyfill-node","docs":null,"changelog":null,"pypi":null,"npm":"rollup-packages-polyfill-core","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}