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

Error in documentation #26536

Closed
LeonardoDaLuz opened this issue Aug 4, 2023 · 2 comments
Closed

Error in documentation #26536

LeonardoDaLuz opened this issue Aug 4, 2023 · 2 comments

Comments

@LeonardoDaLuz
Copy link

LeonardoDaLuz commented Aug 4, 2023

Description

There is an error in the documentation.
It is not possible to import these modules, they do not exist in these folders:

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

Page:
https://threejs.org/docs/#manual/en/introduction/Installation

Reproduction steps

Just enter in this link: https://threejs.org/docs/#manual/en/introduction/Installation

Code

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

Screenshots

image

The correct is:
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';

And those are not detected by autoimport.

Version

0.155.0

Device

Desktop

Browser

Chrome, Firefox, Safari, Edge

OS

Windows

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 4, 2023

Importing should work since the addons alias is defined in the exports section in package.json:

"./addons/*": "./examples/jsm/*",

It seems your development tool does not evaluate this entry.

When directly importing modules in the browser, you have to define an import map like explained in the guide. The import map makes sure imports with three/addons/ can be resolved.

@donmccurdy
Copy link
Collaborator

In some development environments you could use three/examples/jsm/* too, and that is OK. I'm not sure what bundlers do not support exports these days, and would be curious what build system is used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants