公式サイトで確認する癖をつけよう
process.mainModule
The process.mainModule property provides an alternative way of retrieving require.main. The difference is that if the main module changes at runtime, require.main may still refer to the original main module in modules that were required before the change occurred. Generally, it's safe to assume that the two refer to the same module.
As with require.main, process.mainModule will be undefined if there is no entry script.
なんとなくこれでお望みの情報が取れそうな事が確認出来るね。
より詳細にはJSファイルを作ってconsole.log
で確認してみよう。
Bash
1$ cat test.js
2console.log(process.mainModule)
3
4$ node test.js
5Module {
6 id: '.',
7 filename: '<path>/test.js',
8 ...省略
9}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/03 01:59
2017/11/03 02:07