nodejs/node

Simplify vm.Module

Aberta

#43.899 aberto em 19 de jul. de 2022

 (7 comentários) (5 reações) (0 responsável)JavaScript (35.535 forks)batch import
esmexperimentalhelp wantedloadersnever-stalevm

Métricas do repositório

Stars
 (117.218 estrelas)
Métricas de merge de PR
 (Mesclagem média 18d 17h) (219 fundiu PRs em 30d)

Description

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.

Guia do colaborador