Skip to content
loading...
Cover image for module.exports v/s exports - Clearing the confusion

module.exports v/s exports - Clearing the confusion

comscience profile image kapeel kokane twitter logo github logo ・1 min read

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:

https://www.youtube.com/watch?v=Bj1v1Yfg5TU

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Aug 1 '19

Which dev.to loading GIF do you prefer?

I made some dev.to loading gifs

kapeel kokane profile image
Coder by day, Content creator by night, Learner at heart!