A WHATWG fetch ponyfill (does not overwrite native fetch) that wraps github/fetch for the browser and delegates to node-fetch in Node.js. Current version 7.1.0. Ships TypeScript types. Ideal for environments where you need fetch without side effects or globals. Returns a setup function that yields fetch, Request, Response, Headers. Supports Promise and XMLHttpRequest options. Maintained, with regular releases.
npm install fetch-ponyfillNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing the factory, calling it with options, and using the fetch function for an HTTP GET request.
Ensure Node version >=12. Use the factory function to obtain Request, Response, and Headers.
Always call fetchPonyfill() (with or without options) before destructuring.
Remove XMLHttpRequest option; rely on built-in fetch or provide it only for Firefox OS.
Use `import fetchPonyfill from 'fetch-ponyfill'` instead of `import { fetch } from 'fetch-ponyfill'`.Use default import: import fetchPonyfill from 'fetch-ponyfill'; then call it.
Install node-fetch: npm install node-fetch (or it is automatically a dependency).
Correct: const {fetch} = fetchPonyfill(); not const {fetch} = require('fetch-ponyfill');