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
requireorrequire.mainNo
process.mainModuleThe
import.metahas no clues, only hasurl