4.2.x: ESM build cannot be loaded by Node (imports without `.js`)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js, react, typescript
- 领域
- backend, build-system
调研方向
检查 esm/ 下的相对导入,从 esm/index.nohighlight.js、esm/Editor.nohighlight.js、esm/Editor.common.js 和 esm/components/TextArea/*.common.js 中的示例开始。检查生成的 ESM 文件是否存在没有扩展名的相对导入,然后使用提供的 Node 导入命令复现。完成标准是 esm/ 中的每个相对导入都以 .js 结尾,并且 package 能在 Node 中加载。
由索引模型根据 Issue 内容生成。
描述
Since 4.2.0, esm/package.json sets "type": "module", but some relative imports in esm/ still have no .js extension. Node refuses them, so loading the package fails outside a bundler (Vitest, SSR). Bundlers such as Vite still work.
The imports without .js are the ones whose file name has a dot, for example:
esm/index.nohighlight.js:import MDEditor from './Editor.nohighlight';esm/Editor.nohighlight.js:import { createMDEditor } from './Editor.factory';esm/Editor.common.js,esm/components/TextArea/*.common.js: same pattern
Repro (Node 24, @uiw/[email protected]):
npm i @uiw/[email protected] react react-dom
node -e "import('@uiw/react-md-editor/nohighlight')"
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/@uiw/react-md-editor/esm/Editor.nohighlight' imported from .../node_modules/@uiw/react-md-editor/esm/index.nohighlight.js
4.1.6 loads fine: there is no esm/package.json, so the files are not read as strict ES modules.
Expected: every relative import in esm/ ends with .js.
- 主要语言
- TypeScript
- 星标
- 2.9k
- 派生
- 200
- 平均合并
- 6 小时 38 分钟
- 30 天内合并 PR
- 16
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
uiwjs/react-md-editor 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
uiwjs/react-md-editor#702 ·
维护者通常 1 天内回复
-
Setting background color overwrites the textarea font color可能已有人在做 @hiyouwhatsapp 于 11 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 45/100
uiwjs/react-md-editor#701 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
uiwjs/react-md-editor#695 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 45/100
uiwjs/react-md-editor#694 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
uiwjs/react-md-editor#693 ·
维护者通常 1 天内回复
查看 uiwjs/react-md-editor 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 82/100
ClickHouse/clickhouse-js#1130 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
bug claude Minor static-analysis
难度 2/5 1-3 小时 新手友好度 66/100
linagora/cozy-flagship-app#1359 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复