How does require() in node.js work?
Source code is here. exports/require are not keywords, but global variables. Your main script is wrapped before start in a function which has all the globals like require, process etc in its context. Note that while module.js itself is using require(), that’s a different require function, and it is defined in the file called “node.js” … Read more