web3-storage / web3.storage

DEPRECATED ⁂ The simple file storage service for IPFS & Filecoin
https://web3.storage
Other
503 stars 119 forks source link

Old issue needs to be properly addressed #549

Closed OxMarco closed 2 years ago

OxMarco commented 3 years ago

The import line import { Web3Storage, getFilesFromPath } from 'web3.storage'; leads to the error Module not found: Can't resolve 'ipfs-car/blockstore/memory' on ReactJS.

I know this issue has been mentioned here #312 and here #343 but it seems it hasn't been solved yet.

atopal commented 3 years ago

Hey @grcasanova have you tried this? import { Web3Storage } from 'web3.storage/dist/bundle.esm.min.js'

OxMarco commented 3 years ago

yes but the library seems broken for newer nodejs versions FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Udit-takkar commented 2 years ago

yes but the library seems broken for newer nodejs versions FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Yeah facing same issue

adaOctopus commented 2 years ago

Same issue here. Cannot make it work the nft.storage import. Anyone fixed it?

adaOctopus commented 2 years ago

Same issue here. Cannot make it work the nft.storage import. Anyone fixed it?

yes but the library seems broken for newer nodejs versions FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Same issue here. Cannot make it work the nft.storage import. Anyone fixed it?

vasco-santos commented 2 years ago

Do you get this error when adding large files in Node.js?

OxMarco commented 2 years ago

No this error appears during the package installation phase

jilt commented 2 years ago

Same error here, already tried the suggested solution and fails, I need to be able to read Car files for my app :(

srpatel19590 commented 2 years ago

Same error. Module not found: Can't resolve 'ipfs-car/blockstore/memory'

when added import { Web3Storage } from 'web3.storage/dist/bundle.esm.min.js' getting heap out of memory error

Brodan commented 2 years ago

I'm currently dealing with this issue as well

aletheiadata commented 2 years ago

I'm currently having this issue too. Any progress?

jilt commented 2 years ago

Ok, guys I finally was able to fix the problem for me, so I paste my solution here hoping to help people in need. For the team Looks to me that if you remap the package export routes everything can run clean for all of us, if this is true please let me know because i'm flagging the whole package in order not to update it and keep my modifications to the map on the final build. For people Simple steps: 1_update to webpack 5, I followed this tut 2_Update the package.json of your project AND all routes in the webpack config. 3_create an npm "serve" script running both npm build and webpack serve command as explained in the tut. 4 _call the component with import { Web3Storage } from 'web3.storage/dist/bundle.esm.min.js' in your App.js

This should do the magic for dev environment, when you build for production it throws an error:

Module not found: Error: Package path ./dist/bundle.esm.min.js is not exported from package \source\repos\webpack5\node_modules\web3.storage (see exports field in \source\repos\webpack5\node_modules\web3.storage\package.json)

And here's the problem with the map. I changed the exports map with the suggested package route directly into the node_module folder web3.storage, name of file is package.json, that's why i won't be able to update anymore without losing this change, needed for the final react build. this is how my exports look like now:

"exports": { ".": { "browser": "./src/lib.js", "require": "./dist/src/lib.cjs", "node": "./src/lib.js" }, "./src/platform.js": { "browser": "./src/platform.web.js", "require": "./dist/src/platform.cjs", "node": "./src/platform.js" }, "./name": { "browser": "./src/name.js", "require": "./dist/src/name.cjs", "node": "./src/name.js" }, "./dist/bundle.esm.min.js": { "browser": "./dist/bundle.esm.min.js", "require": "./dist/bundle.esm.min.js", "node": "./dist/bundle.esm.min.js" } }, Hope this helps someone, or if I'm doing wrong hope someone from the team will tell me to stop immediately because I'm doing something very dangerous that i didn't recognise. Cheers

mjafri118 commented 2 years ago

Do this: add into your types "declare module 'nft.storage/dist/bundle.esm.min.js';"

sensurusirupus commented 2 years ago

still facing this issue

jilt commented 2 years ago

still facing this issue

yeah, i opened another issue to address it further, but it doesn't look like people are interested in fixing at the moment... #1301

https://github.com/web3-storage/web3.storage/issues/1301