O'Reilly logo
  • Bach Ly thinks this is interesting:

However, if you place a file named package.json inside the module directory, Node will try to parse that file and look for and use the main attribute as a relative path for the entry point. For instance, if your ./myModuleDir/package.json file looks something like the following, Node will try to load the file with the path./myModuleDir/lib/myModule.js:

{
  "name" : "myModule",
  "main" : "./lib/myModule.js"
}