Bindings to React modules are incompatible with node ESM
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js, react
- 领域
- frontend
调研方向
使用报告中链接的 ReScript Pages 升级重现该失败,并检查 src/PagesServer.mjs 中生成的 react/jsx-runtime import。追踪 React 模块声明的生成位置,并在 Node ESM 下验证生成的 imports。生成的 bindings 能够在运行时解析且不会出现 ERR_MODULE_NOT_FOUND,即表示完成。
由索引模型根据 Issue 内容生成。
描述
hello 👋
great work on the release!
I just found out that the new bindings, omitting the .js extension break when using node in ESM mode, as it tries to resolve to .mjs when unspecified. It currently breaks ReScript Pages (https://github.com/bloodyowl/rescript-pages/tree/upgrade-rescript-react) at runtime with the following error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Volumes/Dev/bloodyowl/rescript-pages/node_modules/react/jsx-runtime' imported from /Volumes/Dev/bloodyowl/rescript-pages/src/PagesServer.mjs
Did you mean to import react/jsx-runtime.js?
at new NodeError (node:internal/errors:393:5)
at finalizeResolution (node:internal/modules/esm/resolve:305:11)
at moduleResolve (node:internal/modules/esm/resolve:866:10)
at defaultResolve (node:internal/modules/esm/resolve:1074:11)
at nextResolve (node:internal/modules/esm/loader:164:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:839:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:426:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
and will most likely break any project in this configuration.
would you consider a PR adding the extensions back into the declarations?
- 主要语言
- ReScript
- 星标
- 517
- 派生
- 45
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rescript-lang/rescript-react 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
rescript-lang/rescript-react#145 ·
-
难度 3/5 1-2 天 新手友好度 48/100
rescript-lang/rescript-react#152 · 3 个 reaction ·
-
难度 5/5 一周以上 新手友好度 45/100
rescript-lang/rescript-react#147 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
rescript-lang/rescript-react#111 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
rescript-lang/rescript-react#105 ·
查看 rescript-lang/rescript-react 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
motiondivision/motion#3849 ·
-
area-clientside-dartpad
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
needs-triage Platform(Default)
难度 2/5 1-3 小时 新手友好度 86/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
antfu/node-modules-inspector#214 ·