Why we need to pass module.exports as a parameter since we are already passing module as a parameter?

Viewed 377

I have been going through some online tutorials on Node.js. What I understood is that, on using require(./file-path) function, the node gets the content of that file and wraps inside an immediately invoking function

(function(exports, require, module, __filename, __dirname) {
  // content 
}())

I understood the difference between exports and module.exports. That's all I can see in the internet on searching the above question. But what my question is , why we need to pass module.exports and module to the wrapping IIFE? We could have passed module alone and then get module.exports from it. Is there any advantage on doing like this? Normally when we pass an object to a function , we don't have to pass object.property additionally.

2 Answers
Related