{"library":"node-libs-browser-okam","title":"Node.js Core Libraries for Browsers","description":"This package, `node-libs-browser-okam` (a fork of the original `node-libs-browser`), provides browser-compatible polyfills and mock implementations for a wide range of Node.js core modules such as `buffer`, `process`, `path`, `events`, and `util`. Currently at version `2.2.5`, it is explicitly marked as deprecated and only accepts bug fixes, with no new features or breaking changes planned. Its primary use case is within module bundlers like Webpack to automatically resolve Node.js built-in module imports to browser-compatible alternatives, preventing \"module not found\" errors in front-end applications. The package exports a JavaScript object where keys are Node.js module names and values are the absolute paths to their respective browser implementations or `null` if no browser-compatible version is available. It relies on older versions of some key dependencies like `buffer` and `punycode` to maintain broader browser compatibility (e.g., IE9).\n","language":"javascript","status":"deprecated","last_verified":"Sun Apr 19","install":{"commands":["npm install node-libs-browser-okam"],"cli":null},"imports":["import nodeLibs from 'node-libs-browser-okam';","const nodeLibs = require('node-libs-browser-okam');","const bufferPath = require('node-libs-browser-okam').buffer;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import nodeLibs from 'node-libs-browser-okam';\n\nconsole.log('Available Node.js browser libs:');\n\nfor (const libName in nodeLibs) {\n  const libPath = nodeLibs[libName];\n  if (libPath) {\n    console.log(`- ${libName}: ${libPath}`);\n  } else {\n    console.log(`- ${libName}: (No browser implementation available)`);\n  }\n}\n\n// Example: How a bundler might use it to resolve 'buffer'\nconst resolvedBufferPath = nodeLibs.buffer;\nif (resolvedBufferPath) {\n  console.log(`\\nPath to buffer polyfill: ${resolvedBufferPath}`);\n} else {\n  console.log('\\nBuffer polyfill not found.');\n}\n\n// This package is primarily used by bundlers like Webpack for automatic aliasing.\n// For direct usage, you would typically configure a bundler to use these paths.","lang":"javascript","description":"Demonstrates importing the object of Node.js browser libraries and iterating through the available polyfill paths, highlighting how a bundler might resolve a module like 'buffer'.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}