Description
I've been working on integrating the OrbitControls
from THREE.js into my project. However, I encountered an error message in the Google Chrome DevTools console when trying to import the OrbitControls
object.
The requested module './three.js' does not provide an export named 'EventDispatcher'
Upon manual inspection of three.js
(r119), it's evident that the export EventDispatcher
is present on line 50631.
Question: Based on this information, what could be causing the mentioned error message, and how can I resolve it?
HTML
<!DOCTYPE html>
<html lang="en">
<body>
<script src="three.js" crossorigin="anonymous"></script>
<script src="main.js" type="module"></script>
</body>
</html>
main.js
import { OrbitControls } from './OrbitControls.js'
EDIT: Following advice from Steve, it was uncovered that the root cause of my issue stemmed from mistakenly using the non-module version of three.js
instead of the appropriate one (in my case) known as three.module.js
. To address the error message, ensure you are downloading the correct file - three.module.js
.