JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34804
  • Score
    100M100P100Q160632F
  • License MIT

ESBuild plugin for polyfilling Node.js builtins

Package Exports

  • esbuild-plugin-polyfill-node

Readme

esbuild-plugin-polyfill-node

ESBuild plugin to polyfill Node.js built-ins geared towards edge environments.

Installation

npm install esbuild-plugin-polyfill-node

Usage

import { build } from "esbuild";
import { nodePolyfills } from "esbuild-plugin-polyfill-node";

build({
    entryPoints: ["src/index.js"],
    bundle: true,
    outfile: "dist/bundle.js",
    plugins: [nodePolyfills()],
});

Provided polyfills

Shimmed globals

  • global (aliased to globalThis)
  • process
  • Buffer
  • __dirname (always "/")
  • __filename (always "/index.js")

Empty polyfills

  • dns
  • dgram
  • child_process
  • cluster
  • module
  • net
  • readline
  • repl
  • tls
  • fs
  • crypto

Credits