ipfs / js-ipfs-utils

IPFS utils
Other
23 stars 30 forks source link

Problem when importing fetch in new version of native-fetch #216

Open richtera opened 2 years ago

richtera commented 2 years ago

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 }

welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

richtera commented 2 years ago

It looks like the internal version is using "version": "3.0.0" of native-fetch which still has an export default of fetch. 4.0.2 no longer does.