{"library":"node-stdlib-browser","title":"Node Standard Library for Browser","description":"node-stdlib-browser provides polyfills for Node.js standard library modules, enabling code that relies on these Node.js built-ins to run in browser environments. It serves as a actively maintained alternative to the original `node-libs-browser` package, which is deprecated. Version 1.3.1 is the current stable release. The package does not adhere to a strict time-based release cadence but sees regular updates for dependency bumps, bug fixes, and new bundler support. Key differentiators include explicit support for modern bundlers like Webpack, Rollup, Vite, and esbuild, as well as handling the `node:` protocol for built-in module imports.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-stdlib-browser"],"cli":null},"imports":["import stdLibBrowser from 'node-stdlib-browser';\n// or\nconst stdLibBrowser = require('node-stdlib-browser');","import { NodeProtocolUrlPlugin } from 'node-stdlib-browser/helpers/webpack/plugin';","import { handleCircularDependancyWarning } from 'node-stdlib-browser/helpers/rollup/plugin';","const esbuildShim = require.resolve('node-stdlib-browser/helpers/esbuild/shim');\n// For direct import if your bundler supports it:\n// import esbuildShim from 'node-stdlib-browser/helpers/esbuild/shim';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { defineConfig } from 'vite';\nimport inject from '@rollup/plugin-inject';\n\nconst esbuildShim = require.resolve('node-stdlib-browser/helpers/esbuild/shim');\n\nexport default async () => {\n  const { default: stdLibBrowser } = await import('node-stdlib-browser');\n  return {\n    resolve: {\n      alias: stdLibBrowser,\n    },\n    optimizeDeps: {\n      include: ['buffer', 'process'],\n    },\n    plugins: [\n      {\n        ...inject({\n          global: [esbuildShim, 'global'],\n          process: [esbuildShim, 'process'],\n          Buffer: [esbuildShim, 'Buffer'],\n        }),\n        enforce: 'post',\n      },\n    ],\n  };\n};","lang":"typescript","description":"This quickstart demonstrates how to configure Vite to use `node-stdlib-browser` for polyfilling Node.js built-in modules in a browser environment. It sets up aliases and injects global variables like `process` and `Buffer` using `@rollup/plugin-inject`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}