RangerMauve / js-ipfs-fetch

Use the same `fetch()` API browsers provide for HTTP, but for IPFS
https://youtu.be/kI9Issf3MNc?t=1606
MIT License
65 stars 7 forks source link

Can't resolve 'fs' in fetch-request-body-to-async-iterator when packaging for web #2

Closed ikreymer closed 3 years ago

ikreymer commented 3 years ago

I ran into an issue with webpack packaging js-ipfs-fetch, as it was looking for fs. I ended up commenting that line out, and then was able to build.. (Not sure why it was erroring on load in webpack exactly) This is sort of related to #1, as it seems to assume that this is loaded in a node environmment.

The error I got was (perhaps this issue should be in the 'fetch-request-body-to-async-iterator' module?)

ERROR in ./node_modules/fetch-request-body-to-async-iterator/index.js
Module not found: Error: Can't resolve 'fs' in '.../node_modules/fetch-request-body-to-async-iterator'
 @ ./node_modules/fetch-request-body-to-async-iterator/index.js 45:15-28
 @ ./node_modules/make-fetch/index.js
 @ ./node_modules/js-ipfs-fetch/index.js
 @ ./src/blockloaders.js
 @ ./src/loaders.js
 @ ./src/sw.js
RangerMauve commented 3 years ago

Mind opening an issue on the GH page for that project? I'll update it some time early next week

RangerMauve commented 3 years ago

Fixed by adding a browser field setting fs: false. Out in 1.3.0