esbuild plugin to polyfill Node.js built-in modules when bundling for the browser. Version 0.1.1, stable but rarely updated. Integrates polyfills from rollup-plugin-polyfill-node with tree-shaking support, unlike alternatives that include entire modules. It uses esbuild's inject API to handle globals like 'global', 'process', and optionally 'Buffer'. Requires esbuild as a peer dependency and uses rollup-plugin-polyfill-node internally (a no-op dependency to avoid errors).
npm install esbuild-node-builtinNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the plugin with esbuild bundling for browser, using default options to polyfill 'global' and 'process'.
Ignore the rollup dependency; it is used only internally. Do not install rollup unless required for other projects.
Only set injectBuffer: true if you absolutely need the Buffer global and accept the size cost.
Check the README on GitHub for the latest API if upgrading.
Ensure rollup-plugin-polyfill-node is installed (it is a regular dependency, not optional). Run: pnpm add -D esbuild-node-builtin or npm install esbuild-node-builtin --save-dev
Use named import: import { nodeBuiltin } from 'esbuild-node-builtin'Invoke the function: plugins: [nodeBuiltin()]
Check if the builtin is polyfilled; if not, use a separate polyfill package and add to the 'exclude' option to avoid double bundling.