-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Cannot return value from a SourceTextModule to the caller #37453
Comments
This is working as intended. Can you point me to the location in the docs where it suggests otherwise? |
It pretty much is possible that I misunderstood the docs. What I found was in https://nodejs.org/dist/latest-v15.x/docs/api/vm.html#vm_module_evaluate_options the information that Seems I am not the only one with that problem: A similar question on https://www.titanwolf.org/Network/q/6b88da95-c21a-46dd-bc37-100842de1151/y is still unanswered and the 0.5 line answer in https://stackoverflow.com/questions/60796382/how-to-get-default-export-out-of-vm-sourcetextmodule I admit I do not understand. So the issue might as well be an issue with the docs (or with my ability to understand the docs). |
I think the fix here would be to change the docs to say |
What then would be the way to obtain a value from a module and, for example, access a default export? Wrt a PR on the doc: I am not so knowledgable on how to do that in github :( |
@clecap the default export is available via |
Fixes: nodejs#37453 Signed-off-by: James M Snell <jasnell@gmail.com>
What steps will reproduce the bug?
Make file
retu.js
.Run as
node --experimental.vm.modules retu.js
What is the expected behavior?
According to the current state of the documentation I expect an output of
Result is: 19
What do you see instead?
Output of:
Result is: undefined
The text was updated successfully, but these errors were encountered: