storacha/files-from-path

should use import * as fs from 'fs'; for TS / ES6 style imports

Closed this issue · 0 comments

I was trying to use the JavaScript lib of web3.storage following this doc.
I'm using Angular 11 for my project (also tried Angular 13). Both gave me this error when I tried to start the Angular project after adding the import: import { Web3Storage } from 'web3.storage'

Error: node_modules/files-from-path/types/index.d.ts:72:8 - error TS1192: Module '"fs"' has
no default export.

72 import fs from "fs";

Rob the Bob guided me to the solution, I had to change import fs from "fs"; to import * as fs from 'fs'; in your project in my node_modules folder:

image

I wanted to create a MR to change this line, but don't know how the types folder gets created. Anyhow, maybe you can fix it, or check if your lib works with Angular > version 11.

web3-storage/web3.storage#784