Registry / devops / rollup-runtime-polyfill-core

rollup-runtime-polyfill-core

JSON →
library0.13.4jsnpmunverified

A Rollup plugin that provides polyfills for Node.js built-in modules (e.g., buffer, process, stream, crypto) to enable bundling packages written for Node.js in browser environments. Current stable version is 0.13.4. It is a community-maintained fork of rollup-plugin-node-polyfills, supporting Rollup v1–v4. Key differentiators: supports named imports for many polyfilled modules, includes source maps, and allows fine-grained include/exclude control. Peers: rollup ^1.20 || ^2 || ^3 || ^4.

npm install rollup-runtime-polyfill-core
INSTALL
IMPORT
SIG · ROLLUP-RUNTIME-POL
R
rollup-runtime-polyfill-core
devopsjavascriptv0.13.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nodePolyfills
import nodePolyfills from 'rollup-runtime-polyfill-core'
import { nodePolyfills } from 'rollup-runtime-polyfill-core'
Default export only; named import will result in undefined.
nodePolyfills (CommonJS)
const nodePolyfills = require('rollup-runtime-polyfill-core');
const { nodePolyfills } = require('rollup-runtime-polyfill-core');
CJS default import requires the whole module object.
TypeScript usage
import nodePolyfills from 'rollup-runtime-polyfill-core'; nodePolyfills() as Plugin
Package ships TypeScript types; import as default and cast if needed.

Basic Rollup configuration using rollup-runtime-polyfill-core with node-resolve and commonjs, polyfilling all files and enabling source maps.

// rollup.config.js import nodePolyfills from 'rollup-runtime-polyfill-core'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ resolve(), commonjs(), nodePolyfills({ include: null, // polyfill all files, including source sourceMap: true }) ] }; // package.json script: // "build": "rollup -c"
Debug
Known issues
gotchaDefault export is a function, not a plugin instance. Must call it (e.g., nodePolyfills()) to get the plugin object.
fix
Add parentheses: nodePolyfills() in plugins array.
affects: *
gotchaRollup v3+ changed plugin format; ensure this plugin works with your Rollup version (supported v1–v4).
fix
Check that nodePolyfills() returns an object with 'name' property; if issues, upgrade plugin or use Rollup v2.
affects: >=3.0.0
deprecatedModule 'crypto' polyfill is incomplete; avoid using for security-critical code.
fix
Use a dedicated crypto polyfill library or limit usage to non-sensitive operations.
affects: *
gotchaThe http/https polyfill is a mock; does not implement actual networking.
fix
Do not rely on http polyfill for real requests; use fetch or axios in browser.
affects: *
Errors
Common errors & fixes
Error: 'nodePolyfills' is not a function
Calling nodePolyfills as a constructor or using without parentheses when it should be a function call.
fix
Use nodePolyfills() in plugins array.
TypeError: Cannot read properties of undefined (reading 'apply')
Using named import { nodePolyfills } instead of default import.
fix
Change to import nodePolyfills from 'rollup-runtime-polyfill-core'.
Uncaught ReferenceError: process is not defined
The polyfill did not include the 'process' module; check include options.
fix
Set include: null to polyfill all files, or explicitly include process module.
Upgrade
Version history
0.13.4latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; plugin hooks into Rollup bundling process.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-runtime-polyfill-core — npm install rollup-runtime-polyfill-core · libregistry