A lightweight fetch shim for Node.js that uses the environment's built-in Request, Response, and Headers classes (globals) but replaces the fetch implementation with calls into node:http and node:https. Version 0.4.10 is the latest stable release. Unlike @remix-run/web-fetch or undici-based shims, this avoids Node.js' built-in fetch (which may use an older undici) and provides a more permissive, patched-free implementation. Ships TypeScript types and is ESM-only.
npm install fetch-nodeshimNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of the default fetch export with GET request and JSON parsing.
Test thoroughly if relying on advanced fetch features; consider using native fetch if available.
Upgrade Node.js to 18+ or use a polyfill for these globals.
Use ES modules (type: module in package.json or .mjs extensions).
Switch to default import instead of require('fetch-nodeshim/node-fetch').Use import fetch from 'fetch-nodeshim' (no braces).
Upgrade to Node.js 18+ or add a polyfill (e.g., undici).
Use dynamic import: const fetch = (await import('fetch-nodeshim')).default; or switch to ES modules.No dependency data recorded yet.