Repository navigation
Roadmap for stabilization of vm modules #37648
Copy link
Copy link
Open
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.loadersIssues and PRs related to ES module loaders.Issues and PRs related to ES module loaders.never-staleIssues and PRs exempt from automated stale handling.Issues and PRs exempt from automated stale handling.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
According to @SimenB, here are the issues that should probably be taken care of before we unflag and mark vm modules as stable:
-
vm.Script'simportModuleDynamicallyshould get a reference to thecontextused to run it (#35714) - Simplify vm.Module #43899
- Provide built-in implementations of module linker, initializeImportMeta, importModuleDynamically #31234
- VM ESM with dynamic imports resolves promises before linking is complete (#33216)
- vm.Module.evaluate() morphs loader errors into module evaluation rejections #60242
- Link modules with paths in module.link(linker) #35848
- Provide built-in implementations of module linker, initializeImportMeta, importModuleDynamically #31234
- Improve performance of accessing globals in scripts running in
vmmodules #31658 - SourceTextModule memory leak (#33439)
- Segmentation fault with
import()instead of callingimportModuleDynamically(#35889) - importModuleDynamically for vm module is cached (#36351)
- SourceTextModule leaks memory when context is used #50113
-
vm.SourceTextModulememory leak #59118 - Provide SourceTextModule sync versions of link and evaluate methods #59656
-
SourceTextModule: Using dynamic imports while passingcachedDatathrowsTypeError: Invalid host defined options#43663 - Change API of
module.lnk((specifier) => module)tomodule.link(specifiers, modules)so that it has fewer C++ -> JS calls and can be reused to implementrequire(esm). - Source phase import support.
Tracking issue in Jest: jestjs/jest#9430
/cc @devsnek
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.loadersIssues and PRs related to ES module loaders.Issues and PRs related to ES module loaders.never-staleIssues and PRs exempt from automated stale handling.Issues and PRs exempt from automated stale handling.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Activity
SimenB commentedon Mar 7, 2021
That last one might be a bug/race condition in Jest's implementation still. I haven't found the time to dig into it properly since opening up the issue, unfortunately. It feels like it's related to some module caching or context GC thing, but that's pure speculation. I have some hope it's related to whatever needs fixing for #36351 (again, speculating)
devsnek commentedon Mar 7, 2021
definitely blocked on v8:9968
SimenB commentedon Aug 25, 2021
The above linked v8 issue has been closed as fixed now (:tada:) - any idea of when we'll know if it's enough for Node's use cases?
targos commentedon Aug 25, 2021
The commit fixing the above V8 issue is in V8 9.4. I'll probably open a PR upgrading to that version next week.
devsnek commentedon Aug 25, 2021
it is not fixed quite yet, check v8:10284
SimenB commentedon Aug 25, 2021
Ah ok, thanks for the link! Seems there's quite a bit of activity recently, so hopefully it's not too far away 🙂
vjeux commentedon Feb 2, 2022
Just wanted to say that Jest is blocked on those tasks being completed in order to properly support ESM. It would be amazing if this could be prioritized!
jasonwilliams commentedon Feb 28, 2022
Vitest is also blocked on those tasks too by the looks of vitest-dev/vitest#795 (comment). It seems to segfault on
vm.runInThisContextwhen ran in debug mode on VSCodebenmccann commentedon Mar 8, 2022
I got another segfault in Vitest: vitest-dev/vitest#317
piranna commentedon Jun 7, 2022
bytenodeis also blocked by this.44 remaining items
vm: make vm.Module.evaluate() conditionally synchronous
benchmark: add benchmark for leaf source text modules
vm: make vm.Module.evaluate() conditionally synchronous
benchmark: add benchmark for leaf source text modules
vm: make vm.Module.evaluate() conditionally synchronous
benchmark: add benchmark for leaf source text modules
vm: make vm.Module.evaluate() conditionally synchronous
joyeecheung commentedon Apr 13, 2026
For those who are still watching - I opened a new proposal for revamping the API so that we can stablize it after addressing the current known issues with a new design #62720
LeonxLJX commentedon Sep 1, 2026