node icon indicating copy to clipboard operation
node copied to clipboard

Roadmap for stabilization of vm modules

Open targos opened this issue 3 years ago • 25 comments

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)

SimenB avatar Mar 07 '21 12:03 SimenB

definitely blocked on v8:9968

devsnek avatar Mar 07 '21 13:03 devsnek

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?

SimenB avatar Aug 25 '21 11:08 SimenB

The commit fixing the above V8 issue is in V8 9.4. I'll probably open a PR upgrading to that version next week.

targos avatar Aug 25 '21 12:08 targos

it is not fixed quite yet, check v8:10284

devsnek avatar Aug 25 '21 13:08 devsnek

Ah ok, thanks for the link! Seems there's quite a bit of activity recently, so hopefully it's not too far away 🙂

SimenB avatar Aug 25 '21 14:08 SimenB

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!

vjeux avatar Feb 02 '22 17:02 vjeux

Vitest is also blocked on those tasks too by the looks of https://github.com/vitest-dev/vitest/issues/795#issuecomment-1050129692. It seems to segfault on vm.runInThisContext when ran in debug mode on VSCode

jasonwilliams avatar Feb 28 '22 11:02 jasonwilliams

I got another segfault in Vitest: https://github.com/vitest-dev/vitest/issues/317

benmccann avatar Mar 08 '22 22:03 benmccann

bytenode is also blocked by this.

piranna avatar Jun 07 '22 11:06 piranna

I think the root V8 bug is now chromium:1238312. There was recent activity on this CL: https://chromium-review.googlesource.com/c/v8/v8/+/3172764

targos avatar Jul 19 '22 06:07 targos

expansion doesn't work for chromium bugs, correct url is: https://bugs.chromium.org/p/chromium/issues/detail?id=1238312

v8 is working on overhauling host_defined_options to be a single Data instead of a FixedArray, as well as moving it to a common place that behaves better with caching for both modules and scripts (this includes the deprecation of v8::ScriptOrModule!!). i don't know what their planned timelines are but there's also some info here: https://bugs.chromium.org/p/chromium/issues/detail?id=1244145

devsnek avatar Jul 19 '22 06:07 devsnek

I added support for chromium: expansion.

targos avatar Jul 19 '22 06:07 targos

Should #44211 be added to the OP?

SimenB avatar Sep 23 '22 11:09 SimenB

vite also would have a use case for VM modules, if they were made stable.

silverwind avatar Apr 21 '23 15:04 silverwind

Any update on this? As mentioned earlier, using imports in jest test files needs the experimental flag

NODE_OPTIONS=--experimental-vm-modules jest

https://github.com/jestjs/jest/issues/12990#issuecomment-1182544621

HarikrishnanBalagopal avatar May 03 '23 22:05 HarikrishnanBalagopal

Any update on this?

Pull requests are welcome!

GeoffreyBooth avatar May 03 '23 22:05 GeoffreyBooth

cmon.. it's been years. This feature would help w/ so much in the JS ecosystem

AlbertMarashi avatar May 09 '23 14:05 AlbertMarashi

Pull requests are still welcome.

targos avatar May 09 '23 14:05 targos

After 2.5 years, one of the issues in the OP can finally be checked off 😀

SimenB avatar Sep 14 '23 16:09 SimenB

@joyeecheung can the first item be ticked off since https://github.com/nodejs/node/issues/33439 is closed?

thernstig avatar Oct 15 '23 13:10 thernstig

Not sure if there's an issue for it, but the cache misses in vm.Script that was mitigated in #50137 (released in 21.1.0) will resurface when vm modules are unflagged - so fixing the cache in those cases should probably also be a blocker before unflagging/stabilizing.

SimenB avatar Oct 26 '23 08:10 SimenB

Just to be clear, is this what is blocking VSCode extensions from using ES modules?

metawrap-dev avatar Apr 05 '24 05:04 metawrap-dev

@metawrap-dev no

woss avatar Apr 05 '24 07:04 woss