nodejs / nodejs/node

Simplify vm.Module

未关闭
#43,899 8 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

esm experimental help wanted loaders never-stale vm
主要语言
JavaScript
星标
122k
派生
37.3k
平均合并
4 天 2 小时
30 天内合并 PR
283

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 vm.Module API 文档开始,并将其中的示例与 vm.Script API 进行比较。审查上下文创建和模块链接所要求的默认值,然后确定一种具体的 API 形式,在不进行自定义链接的情况下提供直接明了的 ESM 等效方案。提案足够具体、可以实施,并且保留正常的 Node 模块链接行为,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
api
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。