nodejs/node

Simplify vm.Module

Open

#43.899 aperta il 19 lug 2022

Vedi su GitHub
 (7 commenti) (5 reazioni) (0 assegnatari)JavaScript (35.535 fork)batch import
esmexperimentalhelp wantedloadersnever-stalevm

Metriche repository

Star
 (117.218 star)
Metriche merge PR
 (Merge medio 13g 4h) (233 PR mergiate in 30 g)

Descrizione

One thing that comes up in user feedback about the vm.Module API is that it requires excessive boilerplate, as you can see in the example in the docs: https://nodejs.org/api/vm.html#class-vmmodule. I think that most users want a straightforward ESM equivalent to vm.Script, without needing to define a context or a custom function for linking; the default should be to link modules as Node itself normally does. See also https://github.com/nodejs/node/issues/43288#issuecomment-1144112887.

Guida contributor