Sep 2, 2018 · 1 min read
Great explanation! Once I understood that exports and module.exports refer to the same Object this became crystal clear.
So the only way to fall into this trap is if you re-assign exports like demonstrated.
exports = {
divide(a,b) { return a/b }
}Otherwise you can use the two interchangeably.
I’m not sure why you’d ever re-assign exports. Maybe someone else can explain.