-
Notifications
You must be signed in to change notification settings - Fork 18
Bug: import() doesn’t work in string input #67
Comments
this is pending a redesign of ModuleWrap and Contextify registration. in the short term we can set the import dynamically callbacks for them but they leak like hell. |
I’m working on a PR related to |
add an importModuleDynamically callback to https://github.com/nodejs/node/blob/ceb80f415798818a059051537132bba691c68db7/lib/repl.js#L356 @guybedford at this point do you think its worth trying to convince v8 to change host_defined_options to a |
What should the callback be? Just a noop function? And are you sure that’s the place? The REPL isn’t in the stack trace. |
@GeoffreyBooth oh sorry not just the repl, all the places that use contextify scripts or module wraps need to have the callback, and i think the callback just needs to return for module wraps you need to do this (https://github.com/nodejs/node/blob/ceb80f415798818a059051537132bba691c68db7/lib/internal/modules/esm/translators.js#L48) |
So should I submit a PR against core that does that? Is there any reason not to? |
@GeoffreyBooth it should be mostly fine. the callbacks and some other associated data are leaked in some cases, which is probably only noticeable with a repl where you've got a large number of short lived scriprts. |
@devsnek I do think we should try move forward with the v8 API upgrading host_defined_options to Local. That form seems important to remain GC compatible I think so we can get garbage collection working out. Previously I was hoping we could find a way to fix the root cause of this, but if we know for sure we can make progress with v8 on the above, then it could make sense to just make the references leaky persistent in the mean time too - but the caveat on this is being sure we can move forward with the given fix architecture. |
@guybedford i'm working on a patch for v8 |
Will the v8 patch be ABI breaking or be able to be backported? |
@MylesBorins currently not abi compatible: https://chromium-review.googlesource.com/c/v8/v8/+/1553008 |
This was fixed a long while ago. |
Using nodejs/node@ceb80f4 on Mac:
When working with files, the output is as expected:
But when the same input is passed in as a string, we get an unexpected error:
The same error appears for the following:
related: nodejs/node#19570
The text was updated successfully, but these errors were encountered: