Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"no exported member" errors when using NodeNext module/moduleResolution in TypeScript #342

Open
bhouston opened this issue Jan 23, 2024 · 0 comments · May be fixed by #343
Open

"no exported member" errors when using NodeNext module/moduleResolution in TypeScript #342

bhouston opened this issue Jan 23, 2024 · 0 comments · May be fixed by #343
Labels
bug Something isn't working

Comments

@bhouston
Copy link

  • three version: n/a
  • @types/three version: n/a
  • three-stdlib version: 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.

@bhouston bhouston added the bug Something isn't working label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant