I have done quite some search already. However, still having doubts about the main parameter in package.json of Node.js.
From the npm documentation:
The main field is a module ID that is the primary entry point to your program. That is, if your package is named foo, and a user installs it, and then does require("foo"), then your main module's exports object will be returned.
This should be a module ID relative to the root of your package folder.
For most modules, it makes the most sense to have a main script and often not much else.
To put it short:
mainparameter in your
package.jsonif the entry point to your package differs from
index.jsin its root folder. For example, people often put the entry point to
lib/<packagename>.js, in this case the corresponding script must be described as
main, simply because the entry point
require('yourpackagename')must be defined unambiguously.