Company
Date Published
Author
George MacKerron
Word count
1274
Language
English
Hacker News points
1

Summary

NPM is a package manager for JavaScript that assumes it's running on Node.js, causing issues when used outside of Node.js. To resolve this, developers use techniques such as third-party shims to replace Node-specific features with equivalent libraries, bundling code with esbuild to combine dependencies into a single bundle, and creating stub packages or re-implementing critical functionality. These methods enable NPM packages to be run in environments beyond Node.js, including Vercel Edge Functions, web browsers, and serverless platforms.