"no exported member" errors when using NodeNext module/moduleResolution in TypeScript
関連するプルリクエストがすでにマージされています。
- #343 @CodyJasonBennett による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- three.js, typescript
- 領域
- tooling
調査の方向性
まず、tsconfig.json の NodeNext 設定で src/Scene.tsx から報告された import を再現し、TSC を実行します。パッケージのエクスポートされた型と、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 ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
Update MeshOpt v1オープン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 日以内に返信