Node.js 13 recently rolled out an experimental ESModule loader, starting to take the switch away from CommonJS. However, code ran in an ESModule in Node.js isn't provided a require function, instead requiring the use of the new import syntax.
My problem is that typically the way to find out if a module was loaded via an import or ran directly from the command line requires the require function to be provided, because it check's require's main property against the current module's module object. Since require isn't provided in an ESModule in Node.js, how do I check if my ESModule was imported or ran directly from the command line?