"no exported member" errors when using NodeNext module/moduleResolution in TypeScript
已经有一个关联 PR 被合并了。
- #343 来自 @CodyJasonBennett —— 已合并
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- three.js, typescript
- 领域
- tooling
调研方向
首先,使用 tsconfig.json 中的 NodeNext 设置重现从 src/Scene.tsx 报告的 import,并运行 TSC。将 package 导出的类型与 NodeNext 模块解析下的行为进行比较。当 GLTF 和 GLTFLoader 无需 ESNext/Node workaround 即可作为导出的成员完成编译时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
threeversion: n/a@types/threeversion: n/athree-stdlibversion: 2.29.4
Problem description:
I ran into this bug and it took a while to figure out. It turns out that this library (as well as threes-stdlib) are not compatible with "NodeNext" module/moduleResolution, e.g. if you tsconfig.json looks like this:
"module": "NodeNext",
"moduleResolution": "NodeNext",
And you try to use this library like this:
Code:
import { GLTF, GLTFLoader } from 'three-stdlib'
You will get compile errors via TSC like this:
src/Scene.tsx:17:16 - error TS2305: Module '"three-stdlib"' has no exported member 'GLTFLoader'.
You can work around the bug by switching your tsconfig.json to something like this instead:
"module": "ESNext",
"moduleResolution": "Node",
Relevant code:
Included in the above description.
Suggested solution:
I suspect there is some way to fix this? But I do not yet know. One clue is that @react-three/fiber and @react-three.drei work properly with these tsconfig.json settings.
- 主要语言
- JavaScript
- 星标
- 863
- 派生
- 146
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pmndrs/three-stdlib 的其他 Issue
-
SSAOPass height type error,It's number not boolean可能已有人在做 @Techsynx 于 23 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 62/100
pmndrs/three-stdlib#423 ·
-
难度 4/5 3-5 天 新手友好度 58/100
pmndrs/three-stdlib#437 ·
-
bug
难度 4/5 3-5 天 新手友好度 42/100
pmndrs/three-stdlib#435 ·
-
OrbitControls touch crashes on Expo mobile app可能已有人在做 @adamistheanswer 于 164 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 68/100
pmndrs/three-stdlib#426 · 1 条评论 · 1 个 reaction ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 45/100
pmndrs/three-stdlib#425 ·
查看 pmndrs/three-stdlib 的全部 Issue
相似的 Issue
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 85/100
-
Add a language未关闭good first issue
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement frontend priority:P3
难度 2/5 1-3 小时 新手友好度 72/100
geolens-io/geolens#4153 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 66/100
xdelmo/Portfolio-minimal#667 ·
维护者通常 1 天内回复
-
enhancement javascript
难度 2/5 1-3 小时 新手友好度 88/100
tamadalab/welfare-time#165 ·
维护者通常 1 天内回复