A cross-platform fetch API ponyfill that provides the WHATWG fetch, Request, Response, and Headers interfaces using undici (Node.js) or native browser/cross-platform implementations. Version 0.4.14 is the latest stable; the package is actively maintained as part of the @whatwg-node family, with frequent releases. It differs from alternatives like 'node-fetch' by leveraging undici for Node.js (faster, HTTP/2 support) and providing TypeScript types out of the box. Designed for isomorphic JavaScript, it ensures consistent fetch semantics across Node.js, Deno, and browsers, with minimal polyfill footprint.
npm install cross-undici-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of the fetch ponyfill with POST request and JSON response parsing.
Use dynamic import: const { fetch } = await import('cross-undici-fetch');Migrate to @whatwg-node/fetch (same API, better maintenance).
Install web-streams-polyfill: npm install web-streams-polyfill
Use dynamic import: const { fetch } = await import('cross-undici-fetch');Use named import: import { fetch } from 'cross-undici-fetch';