js-ipfs-utils icon indicating copy to clipboard operation
js-ipfs-utils copied to clipboard

Problem when importing fetch in new version of native-fetch

Open richtera opened this issue 2 years ago • 2 comments

https://github.com/ipfs/js-ipfs-utils/blob/5eecdcbd81f5448ba1d4c0d2ad2050d0ceb240a0/src/fetch.browser.js#L10

When using the browser compile of this, the system ultimately imports "native-fetch" but the API of native-fetch doesn't have fetch as the default export, but rather as { fetch } on the exports.

The implementation is here https://github.com/achingbrain/native-fetch/blob/master/src/index.js So either this code should be changed to not use default here

https://github.com/ipfs/js-ipfs-utils/blob/5eecdcbd81f5448ba1d4c0d2ad2050d0ceb240a0/src/http/fetch.browser.js#L5

Or request native-fetch to export fetch as default in addition to { fetch }

richtera avatar Oct 15 '22 17:10 richtera