Guy Bedford
Guy Bedford
I believe https://gist.github.com/guybedford/e6687e77d60739f27d1b5449a2872bf4 can be updated relatively simply to work without `dynamicInstantiate`. @giltayar also did some excellent investigations here in his post.
Amazing to see this work, thanks @wesleytodd for investigating. @ljharb would you disagreement over stability be mitigated by flagging such an implementation. Personally I see no harm in experimentation in...
I really like the `import.meta.main` concept. Currently in Node.js it is common for CLI tools to do the following check: ```js if (require.main === module) { console.log('This is a CLI...
@ljharb this use case is explicitly documented in https://github.com/nodejs/node/blob/master/doc/api/modules.md#accessing-the-main-module.
@ljharb yes it is a desired feature. The `require.main === module` was something we had to explicitly support in the ncc project as users were using it in CLI tools....
@shian15810 thanks for showing an interest in the modules work! Contributions are very much welcome to Node.js core and the module work here. We do have some consensus issues for...
I still believe this is an important feature, to be put in the same basket as _CJS features not available in ESM_ like `require.resolve`. It's not a common feature, but...
To clarify some of the above, the only module that gets `import.meta.main` set is the module passed into `node main.js` it is only the module corresponding to `process.argv[1]`. And no,...
The existing Node.js pattern it is replacing is the `require.main === module` pattern which is documented in the Node.js docs for require - https://nodejs.org/dist/latest-v13.x/docs/api/modules.html#modules_accessing_the_main_module
@wesleytodd thanks for suggesting a path here, that would be huge. I'm not sure we necessarily should have an official scaffolding tool for Node.js, but working with npm and Yarn...