Registry / devops / esbuild-plugin-node-polyfills

esbuild-plugin-node-polyfills

JSON →
library1.0.2jsnpmunverified

Provides Node.js built-in module polyfills for esbuild bundler, similar to Webpack's 'node' option. Version 1.0.2 (latest, 2021) is stable but unmaintained since. Requires manual installation of peer dependencies: browserify-zlib, buffer, crypto-browserify, events, https-browserify, os-browserify, path-browserify, process, stream-browserify, stream-http, url, util. Compared to alternatives like @esbuild-plugins/node-globals-polyfills, this plugin offers a more complete set of polyfills but lacks ESM support and TypeScript definitions.

npm install esbuild-plugin-node-polyfills
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-NOD
E
esbuild-plugin-node-polyfills
devopsjavascriptv1.0.2
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.

ESBuildNodePolyfillsPlugin
const ESBuildNodePolyfillsPlugin = require('esbuild-plugin-node-polyfills');
import ESBuildNodePolyfillsPlugin from 'esbuild-plugin-node-polyfills';
The package uses CommonJS; no ESM export is provided. Use require.

Demonstrates how to configure esbuild with the node polyfills plugin using CommonJS.

const ESBuildNodePolyfillsPlugin = require('esbuild-plugin-node-polyfills'); const esbuild = require('esbuild'); require('esbuild').build({ entryPoints: ['src/index.js'], bundle: true, outfile: 'dist/bundle.js', plugins: [ESBuildNodePolyfillsPlugin], }).catch(() => process.exit(1));
Debug
Known issues
gotchaAll dependencies must be installed manually as peer dependencies; automatic installation is not provided.
fix
Run: npm install browserify-zlib buffer crypto-browserify events https-browserify os-browserify path-browserify process stream-browserify stream-http url util
affects: >=1.0.0
gotchaThe plugin only works with CommonJS; it cannot be imported using ES module syntax (import).
fix
Use require() instead of import.
affects: >=1.0.0
gotchaPolyfills are injected globally, which may cause unexpected side effects in libraries that expect the original Node.js behavior.
fix
Consider using @esbuild-plugins/node-globals-polyfills for more controlled polyfilling.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'buffer'
Missing peer dependency 'buffer' is not installed.
fix
npm install buffer
Error: The plugin 'ESBuildNodePolyfillsPlugin' is not a function
Using import instead of require; the package exports a function via CommonJS.
fix
Change to: const ESBuildNodePolyfillsPlugin = require('esbuild-plugin-node-polyfills');
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
browserify-zlibrequiredpolyfills Node.js zlib module
bufferrequiredpolyfills Node.js buffer module
crypto-browserifyrequiredpolyfills Node.js crypto module
esbuildrequiredpeer dependency for plugin usage
eventsrequiredpolyfills Node.js events module
https-browserifyrequiredpolyfills Node.js https module
os-browserifyrequiredpolyfills Node.js os module
path-browserifyrequiredpolyfills Node.js path module
processrequiredpolyfills Node.js process module
stream-browserifyrequiredpolyfills Node.js stream module
stream-httprequiredpolyfills Node.js http module
urlrequiredpolyfills Node.js url module
utilrequiredpolyfills Node.js util module
Agent activity
2 hits · last 30 days
node
2
Resources