-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require.main is undefined when using --experimental-modules #21143
Comments
What would you expect it to print? Without |
I was expecting to be no difference in behavior (using the flag or not). p.s. all the other properties of |
Yes, but they don't use the traditional module loader where The new module loader doesn't really have a concept of "main-ness" right now and I don't know if that is something that ought to be fixed. One for @nodejs/modules to consider. |
Oh i see, thank you for your quick response. Maybe this should be solved before esm support drop experimental status, because it will break all |
I found this a few weeks ago but wasn't sure how to fix it, I'll take another look before friday. |
Agreed this is a bug, had just put on my list to fix too. |
@guybedford Is this issue still open? |
@vsnehil92 yes, because the linked PR #21150 hasn't yet been merged. |
@ljharb The changes have already been approved. |
yes, but issues typically stay open til the PR is merged. |
#21150 was merged. Closing. |
When running node with --experimental-modules flag, the global
require
object has amain
property but its value is alwaysundefined
. Is this by design?The text was updated successfully, but these errors were encountered: