Requiring a module steps made by node
Then the follow is the logic followed by Node.js for a require('something') statement:
• If something is a core module, return it.
• If something is a relative path (starts with ‘./’ , ‘../’) return that file OR folder.
• If not, look for node_modules/filename or node_modules/foldername each level up until you
find a file OR folder that matches something.
When matching a file OR folder:, follow these steps:
• If it matched a file name, return it.
• If it matched a folder name and it has package.json with main, return that file.
• If it matched a folder name and it has an index file, return it.