-
Notifications
You must be signed in to change notification settings - Fork 1.2k
error importing ipfs-core from TypeScript "Cannot find namespace 'fs'." #4080
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
I was able to recreate this issue only against ipfs-utils, not ipfs-core. So I will open an issue/PR there. The good news is I think I also have a patch for ipfs-utils that will fix it (based on npm link testing) |
Hi, |
Motivation: * Fix ipfs/js-ipfs#4080 * tl;dr * fix `import globSourceImport from 'ipfs-utils/src/files/glob-source.js'` from typescript * fix importing ipfs-core from typescript Context: * microsoft/TypeScript#23857 Strategy * Use jsdoc `@return` instead of `@yields` because tsc doesn't understand that `@yields` implies a `@return` type Test Case * gobengo/ipfs-core-esm-test#3 * I tested locally with `npm link` and this seemed to fix it
@callezenwaka For now, adding |
reopening to track ipfs-core upgrading to the fixed ipfs-utils@9.0.6 (if needed) |
Platform: Darwin MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T8101 arm64
Subsystem:
ipfs-core package
npm publish
happens, since the error referencesnode_modules/ipfs-utils/dist/src/files/glob-source.d.ts
Severity: High (library not usable in this context)
Description:
Note: this issue is similar to #4029 , but a different ts error so not the same
Steps to reproduce the error:
import * as IPFS from 'ipfs-core'
tsc build
I tried clonging js-ipfs repo myself to
npm link
and find a fix, butnpm install
on my m1 mac fails becausenpm ERR! response status 404 Not Found on https://node-webrtc.s3.amazonaws.com/wrtc/v0.4.7/Release/darwin-arm64.tar.gz
which is node-webrtc/node-webrtc#680The text was updated successfully, but these errors were encountered: