Registry / devops / real-isomorphic-fetch

real-isomorphic-fetch

JSON →
library3.0.0jsnpmunverified

Isomorphic fetch wrapper that adds cookie and redirect handling across Node.js, browser, and React Native. Version 3.0.0 is current and stable, with infrequent releases. Unlike many isomorphic fetch libraries, this one automatically manages cookies across requests and handles redirects transparently, normalizing node-fetch behavior to match browser fetch. It layers on top of any fetch implementation (e.g., node-fetch, window.fetch, global.fetch) to provide consistent behavior without requiring manual redirect interception.

npm install real-isomorphic-fetch
INSTALL
IMPORT
SIG · REAL-ISOMORPHIC-FE
R
real-isomorphic-fetch
devopsjavascriptv3.0.0
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.

IsomorphicFetch
import IsomorphicFetch from 'real-isomorphic-fetch'
const { IsomorphicFetch } = require('real-isomorphic-fetch')
Default export (class) – named destructured require breaks. CJS uses require('real-isomorphic-fetch') directly.
IsomorphicFetch
const IsomorphicFetch = require('real-isomorphic-fetch')
const { default: IsomorphicFetch } = require('real-isomorphic-fetch')
CJS require gets the default export; no destructuring needed.
IsomorphicFetch
import IsomorphicFetch from 'real-isomorphic-fetch'
import { IsomorphicFetch } from 'real-isomorphic-fetch'
Named import is incorrect; use default import.

Creates an isomorphic fetch instance with cookie + redirect support, fetches a URL that sets cookies, then logs response text.

import IsomorphicFetch from 'real-isomorphic-fetch'; import fetch from 'node-fetch'; // For Node.js; browser uses native fetch const fetchInstance = new IsomorphicFetch(fetch); fetchInstance('https://httpbin.org/cookies/set?foo=bar') .then(response => response.text()) .then(text => console.log(text)) .catch(err => console.error(err));
Debug
Known issues
gotchaCookies are shared across all IsomorphicFetch instances created from the same module; instances do not have isolated cookie jars.
fix
Use separate modules/processes if isolation is needed, or manually clear cookies via private methods.
affects: >=1.0.0
gotchaIn browsers, the constructor expects window.fetch; if not provided, it will use the global fetch, but if window.fetch is polyfilled, pass it explicitly.
fix
new IsomorphicFetch(window.fetch) instead of relying on default.
affects: >=1.0.0
deprecatedThis package depends on a separate fetch implementation; it does not include its own polyfill, which may cause confusion.
fix
Always pass a fetch implementation as the constructor argument.
affects: >=1.0.0
gotchaRedirects are followed automatically; there is no way to manually intercept redirects as in some libraries.
fix
If you need redirect interception, use fetch-cookie or raw node-fetch with manual redirect handling.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: IsomorphicFetch is not a constructor
Using destructured import or require incorrectly.
fix
Use default import/require: const IsomorphicFetch = require('real-isomorphic-fetch');
Error: Cannot find module 'node-fetch'
node-fetch not installed in Node.js environment.
fix
npm install node-fetch
TypeError: fetch is not a function
No fetch implementation provided in the constructor, and no global fetch exists (e.g., in older Node.js without global fetch).
fix
Pass a fetch implementation: new IsomorphicFetch(require('node-fetch'));
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
node-fetchoptionalRequired in Node.js environments to provide fetch API; browser and React Native use native fetch.
Agent activity
6 hits · last 30 days
node
6
Resources
real-isomorphic-fetch — npm install real-isomorphic-fetch · libregistry