文章列表nodejsindex判断主模块On this page判断主模块ES Modeif (process.mainModule === undefined) { // 当前为主模块 console.log(123123123123);}CommonJSif (require.main === module) { // 当前为主模块}