npm isomorphic-unfetch 4.0.0

latest releases: 4.0.2, 4.0.1
16 months ago

🦄 Small breaking change for awesome ponyness:

  • unfetch is now a pure ponyfill.
  • unfetch/polyfill is now the polyfill version (even smaller than the ponyfill!)
  • All modules are shipped in all formats, and the polyfill is now < 500b.
  • Also a little bugfix for IE11 (#85, thanks @khusa)

TL;DR: require('unfetch') no longer returns window.fetch when it exists. For that, use unfetch/polyfill.

This change makes unfetch lovely to use as a polyfill from HTML:

<script src="https://unpkg.com/unfetch/polyfill"></script>
<!-- that's it! -->
<script>foo = await fetch('/foo.json')</script>

Otherwise, if you're using Unfetch and bundling your code, continue as you were before:

if (!self.fetch) self.fetch = require('unfetch');
// or simply:
import 'unfetch/polyfill';

Important - the one thing to avoid:

Since unfetch is a proper ponyfill, it will now overwrite fetch even in supported browsers if you do the following

// never do this!
window.fetch = require('unfetch');

Don't miss a new isomorphic-unfetch release

NewReleases is sending notifications on new releases.