This simplified Chinese blog tells the details about the difference between module.exports
and exports
.
The most surprising part of the difference is that you can not use them together at the same time. (I know no one would use it in this way, because you have to make sure the coding style is the same anywhere.)
After testing, if you use these two ways to export modules, defined methods or properties in exports
will be discarded directly and only export the ones defined in module.exports
.
So I think the best practice here is to use module.exports
instead of exports
to define your stuffs.
Read More on : Here