nodejs/node

Simplify vm.Module

开放

#43,899 创建于 2022年7月19日

 (7 条评论) (5 个反应) (0 位负责人)JavaScript (35,535 个派生)batch import
esmexperimentalhelp wantedloadersnever-stalevm

仓库指标

星标
 (117,218 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南