A minimal 500-byte fetch polyfill that provides a subset of the standard fetch API. Version 5.0.0 is the current stable release, maintained infrequently as it is feature-complete. Unlike larger alternatives (e.g., whatwg-fetch), unfetch focuses on bare-bones functionality: it only supports text and JSON responses, uses Arrays instead of Iterables, and has no streaming support. It works as both a polyfill (auto-installs on window.fetch) and a ponyfill (importable function). TypeScript types are included. Requires a Promise polyfill for IE11 and below.
npm install unfetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic fetch usage with unfetch as a ponyfill for typed environments.
Use alternatives like whatwg-fetch if streaming is required.
Use a more complete polyfill if those features are needed.
Do not rely on blob(), arrayBuffer(), formData(), or other methods.
Use ponyfill mode if you need to preserve an existing fetch implementation.
Include a Promise polyfill (e.g., es6-promise) before unfetch.
Use import 'unfetch/polyfill' or <script src="https://unpkg.com/unfetch/polyfill"></script>.
Catch the error and check the message pattern; or use the ponyfill which rejects with a TypeError.
Use import 'unfetch/polyfill' (no symbol) to apply the polyfill globally.
Check response.ok before calling response.json().
Update to unfetch@5 or access headers as a plain object via response.headers property.
No dependency data recorded yet.