This is how i am linking files
and this is how i am initializing orbital controls
const orbitControl = new THREE.OrbitControls(camera, renderer.domElement);
and this is the error i am getting
OrbitControls.js:1 Uncaught ReferenceError: require is not defined
(anonymous) @ OrbitControls.js:1
index.js:85 Uncaught TypeError: THREE.OrbitControls is not a constructor
I tried everything i could but cannot resolve it. Please help!
This version of OrbitControls you are trying to include is meant to be used within an npm project, and not directly imported in a browser.
Try including this version instead: https://firstname.lastname@example.org/examples/js/controls/OrbitControls.js
Thanks for the reply i appreciate it, but it’s still producing an error
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://email@example.com/examples/js/controls/OrbitControls.js with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
index.js:83 Uncaught TypeError: THREE.OrbitControls is not a constructor
(anonymous) @ index.js:83
It’s still producing those two errors, for the latter error i tried to remove the THREE. but still i produced a an error, something along the lines of “orbitcontrols is not defined”
Try it with these two imports:
In general it makes no sense to import library files from different CDNs. And it’s definitely wrong to import
three.js files from different releases.
Thank You! It’s working again
I was trying to find cdn for the latest release but was having trouble, so i used the r128 version, but now i know that i should use the latest release and the same cdns