Registry / networking / isomorphic-fetch-ponyfill

isomorphic-fetch-ponyfill

JSON →
library0.3.18jsnpmunverified

A fetch ponyfill that works across Node.js, browsers, React Native, and Cloudflare Workers. Version 0.3.18 provides a simple, no-dependency implementation of the Fetch API designed as a proper ponyfill (does not pollute globals). It is isolated from the environment's native fetch, making it suitable for sandboxed runtimes like Cloudflare Workers. Unlike cross-fetch, it works in Workers by avoiding Node-specific dependencies. Release cadence is low; the package is stable but not actively developed. The name includes 'ponyfill' to indicate it replaces the global fetch only when explicitly imported, avoiding side effects.

npm install isomorphic-fetch-ponyfill
INSTALL
IMPORT
SIG · ISOMORPHIC-FETCH-P
I
isomorphic-fetch-ponyfill
networkingjavascriptv0.3.18
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetch
import { fetch } from 'isomorphic-fetch-ponyfill'
import fetch from 'isomorphic-fetch-ponyfill'
This is a named export, not a default export. CommonJS users can use const { fetch } = require('isomorphic-fetch-ponyfill').
Request
import { Request } from 'isomorphic-fetch-ponyfill'
const Request = require('isomorphic-fetch-ponyfill').Request
Exported as a named module member. TypeScript types are included for Request, Response, and Headers.
Headers
import { Headers } from 'isomorphic-fetch-ponyfill'
import Headers from 'isomorphic-fetch-ponyfill'
Named export; do not use default import.

Demonstrates using named import and making a POST request with the ponyfill fetch.

import { fetch } from 'isomorphic-fetch-ponyfill'; async function main() { const response = await fetch('https://api.example.com/data', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ key: 'value' }) }); const data = await response.json(); console.log(data); } main().catch(console.error);
Debug
Known issues
gotchaPonyfill does not polyfill global fetch; you must import and use the function explicitly. If you use it in a module that also uses global fetch (like newer Node versions), they may conflict.
fix
Always use the imported fetch function explicitly; do not rely on a global fetch.
affects: >=0.0.0
gotchaThe package is designed for Cloudflare Workers but may not support all fetch features (e.g., AbortController or stream responses) in older versions. Test thoroughly in your target environment.
fix
Verify that your use case (e.g., streaming) works; fall back to native fetch if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'isomorphic-fetch-ponyfill'
Package not installed or incorrect import path.
fix
Run 'npm install isomorphic-fetch-ponyfill' and ensure the import statement is correct.
TypeError: fetch is not a function
Using default import instead of named import.
fix
Use 'import { fetch } from 'isomorphic-fetch-ponyfill'' instead of 'import fetch from ...'. If using CommonJS: 'const { fetch } = require(...)'.
Upgrade
Version history
0.3.18latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
isomorphic-fetch-ponyfill — npm install isomorphic-fetch-ponyfill · libregistry