Using NPM packages: meteor-node-stubs question


I’m trying to use a couple of NPM packages, and was hoping somone could explain a few things to me.

(1) Looking to use fs: As far as I can tell, I can use fs in two ways;
(a) Use the fs package which is in node already + use the meteor-node-stubs
(b) Use peerlibrary:fs

I’ve used peerlibrary:fs and this seems to work fine. But what is the difference? I’m also trying to use jsonwebtoken, and this would be using meteor npm install --save jsonwebtoken, with meteor-node-stubs. I’m giving this a go now, but can someone explain why the meteor-node-stubs is required?

From the docs, I think meteor-node-stubs in required only when using these npm pacakges (like jsonwebtoken) on client, and it will work fine on server without the stubs. Is this correct?

Thanks so much.


1 Like