How can I detect if an ECMAScript module is the main module? This is easy for CommonJS modules (see Detect if called through require or directly by command line).
There is no
require
orrequire.main
No
process.mainModule
The
import.meta
has no clues, only hasurl