module.exports v/s exports - Clearing the confusion
kapeel kokane
Posted on September 24, 2019
If you are one of those developers who spends majority of their time writing code in Node & Express, you might understand what I am talking about.
It's all well and good, you have written your code and now you want to use it in another file. You use module.exports this time and it works like a charm.
Next time around, you see an example wherein the "exports" variable is being used to do the same and you follow it. Works well this time too.
But then, once in a while, you try to assign something to the exports global that you are trying to export out of the file and it does not seem to work and you are now confused. This video tries to clear some of that confusion:
Posted on September 24, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.