Indirectly static import cjs with error will cause an uncaughtException
未关闭
还没有人认领这个 Issue。
confirmed-bug
module
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
Version
v20.10.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
// ./main.mjs
process.on('uncaughtException', ()=>console.log('uncaught'));
try {
await import(`data:text/javascript,
import "data:text/javascript,console.log('before')";
import "${import.meta.url}.cjs";
`);
}
catch { console.log('caught'); }
// ./main.mjs.cjs
throw Error('abc');
How often does it reproduce? Is there a required condition?
every time
What is the expected behavior? Why is that the expected behavior?
before
caught
same with dynamic await import('./main.mjs.cjs') directly or indirectly.
also intuitive.
What do you see instead?
before
uncaught
and the wrapper dynamic import promise will be forever pending
Additional information
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行 main.mjs 中的复现程序以及旁边的 main.mjs.cjs 文件,并检查动态导入如何处理间接导入的 CommonJS 模块中的错误。当示例打印出 before 和 caught、不产生 uncaught,并且 wrapper import promise 完成时,修复就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100