NOTE:本文持续更新
CommonJS Module
用require.main
判断是否用命令行运行程序
if (require.main === module) {
// this module was run directly from the command line as in node xxx.js
} else {
// this module was not run directly from the command line and probably loaded by something else
}
https://stackoverflow.com/questions/45136831/node-js-require-main-module