Open FredHappyface opened 9 months ago
It does already support using it in a browser via a sorta-hack (see io.js [1]). However, I don't know anything about NextJS so I don't know how to flag fs
as optional (or however it would work for NextJS).
[1] Checking for typeof window === 'undefined'
was the "recommended" way I had found for detecting a browser vs NodeJS. Have never been happy with that method.
Ah that makes sense and yeah I'm not to sure how next js works to be honest. I'll have a play around/ google and see if I can find anything useful!
Might be that there's a cross platform option that can be used in-place of fs?
I don't know if there's a browser version of fs
that does anything (maybe as a GET/POST in the background..?) and especially that's stand-alone (I prefer as few dependencies as possible). The way it works right now is by detecting it's running in a browser and stubbing the fs
functions used so that they throw an error if they're called. My intent was that only buffers would be supported in the browser, so that the dev using it can decide where those buffers come from.
Hi I've gone down a massive rabbit hole and the dependency of fs means that I cannot get this to run in the browser
Would you be able to add support for this?
Thank you :)