AFAIK, module.exports
and exports
are available through hidden arguments available to any file via a wrapping function and point to the same object in node.js.
If I do this:
exports.foo = 'foo';
module.exports.bar = 'bar';
both foo
and bar
will be accessible to the file that imports it.
Also, I can do this:
module.exports = ()=>{}
But I can't do this:
exports = () =>{}
Why's that? If one is allowed to be overridden so should be the other as both point to the same object. What am I missing?