Every time I attempt to use an NPM package in Vue that requires fs
it doesn't work and it errors out. Normally along the lines of fs could not be resolved
or fs.readFileSync is not a function
.
I have seen some other pages that say fs
doesn't work in browsers because of permission etc...
Just to add, I am not explicitly trying to use the fs module. I am just trying to use the npm package which happens to use fs.
What should I do to make it work? Ive tested these packages on the npm runkit, and everything is fine. And that runs in a browser, so I'm a little confused there also.
The problem here is that Vue will be rendered client side. fs is just for node applications, because it is server side (you should not be able to read data from a client file system). You you have two options:
license (which the module you mentioned in comments is): copying the module and removing the fs part