Orbit Controls - Depreciated in 2020? Cannot import properly

Dear all,
My folder structure is :
folder “js” ->

When I import Three.js into the project with html by:

And us it in main.js by the line
var controls = new THREE.OrbitControls( camera, renderer.domElement );
It returns
Uncaught TypeError: THREE.OrbitControls is not a constructor

I also tried
var controls = new OrbitControls( camera, renderer.domElement );
but it did not work

I also tried importing in ES6 but with no success. I have searched multiple forums and videos for this topic but I haven’t found a solution yet. I also found this line:
console.warn( "THREE.OrbitControls: As part of the transition to ES6 Modules, the files in ‘examples/js’ were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation." );

What should I do? Any advice will be really appreciated.

Many thanks,

Hi, welcome to the forum.

I think you didn’t copy here the code snippet where you import OrbitControls, it is likely the cause of your issue though, can you show it here ?

Also there is an option in this forum to format code snippets, which makes them much easier to read, please use this…

const variable = 1 + foo;
// comment
1 Like

Check out the source for the OrbitControls example:


1 Like