-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Dynamic import not working on eval/print #30591
Comments
I just ran into this. I was testing with this code: import("data:text/javascript,console.log(Date.now())")
.then(console.log).catch(console.error); If you save this as
But run it with
My use case is I’m trying to find a way to tell Node to evaluate ESM code, without using any of the experimental APIs in VM. Ultimately I want to essentially eval ESM code, without needing to define various functions that are part of the loader, such as this dynamic import callback. I just want to inherit those functions from the ESM loader, the same way |
This allows dynamic import to work from CLI `--eval` with or without `--input-type=module`. Fixes: nodejs#30591
They probably didn't provide a dynamic import handler for their vm usage. You should open an issue with them. |
The last one seems the most confusing: The same input string works fine with static import but not with dynamic import from the same file. I assume this is a side-effect of tying the import callback to individual scripts instead of to the context.
The text was updated successfully, but these errors were encountered: