Most Node.js beginners think these are interchangeable:



exports.sayHi = () => console.log("Hi");









module.exports = () => console.log("Hi");






But there's one important difference that can leave you scratching your head when require() suddenly returns {}.




The hidden truth


When Node.js runs your file, it creates...