# ArcballControls.js throws error: "ambiguous indirect export: MathUtils"

**URL:** <https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105>\
**Category:** Questions\
**Tags:** arcball-controls, math\
**Created:** [October 28, 2022, 10:23am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105 "2022-10-28T10:23:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![floko](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@floko](https://discourse.threejs.org/u/floko)\
**Post date:** [October 28, 2022, 10:23am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/1 "2022-10-28T10:23:33Z")

</div>

Hi,  
I just wanted to use ArcballControls instead of OrbitControls (which works fine), but I am getting above error message for MathUtils. It’s related to the line in ArcvallControls.js where MathUtils is imported. (See below code snippet.) What can I do to fix this?  
Thank you!

```javascript

import {
	GridHelper,
	EllipseCurve,
	BufferGeometry,
	Line,
	LineBasicMaterial,
	Raycaster,
	Group,
	Box3,
	Sphere,
	Quaternion,
	Vector2,
	Vector3,
	Matrix4,
	MathUtils,
	EventDispatcher
} from "./three.module.js";

```

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [October 28, 2022, 10:39am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/2 "2022-10-28T10:39:40Z")

</div>

I’ve never seen this error message in context of `three.js` modules. How does your build setup look like?

---

<div class="post-metadata">

**Author:** ![floko](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@floko](https://discourse.threejs.org/u/floko)\
**Post date:** [October 28, 2022, 11:19am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/3 "2022-10-28T11:19:29Z")

</div>

Thanks for your quick reply!  
Not sure if this is what you meant, but my script starts with:

> import \* as THREE from ‘/fk-test/3d-test4/js/three.module.js’;  
> //import {OrbitControls} from ‘/fk-test/3d-test4/js/OrbitControls.js’; // used before  
> import {ArcballControls } from ‘/fk-test/3d-test4/js/ArcballControls.js’;  
> import {GLTFLoader} from ‘/fk-test/3d-test4/js/GLTFLoader.js’;

So the error occurs right on top of the script after importing the basic “three” file.  
All .js files are in the same folder on my web server.  
Or do you mean there might be differences in the versions of the scripts?

---

<div class="post-metadata">

**Author:** ![floko](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@floko](https://discourse.threejs.org/u/floko)\
**Post date:** [October 28, 2022, 11:51am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/4 "2022-10-28T11:51:25Z")

</div>

Just in case the script versions could make a difference, I made sure I took the main module from here

> <https://github.com/mrdoob/three.js/blob/f021ec0c9051eb11d110b0c2b93305bffd0942e0/build/three.module.js>

and this arcball controls module:

> <https://github.com/mrdoob/three.js/blob/f021ec0c9051eb11d110b0c2b93305bffd0942e0/examples/js/controls/ArcballControls.js>

Now I have a different error message 😃  
Uncaught SyntaxError: ambiguous indirect export: ArcballControls

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [October 28, 2022, 11:55am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/5 "2022-10-28T11:55:22Z")

</div>

You can’t combine the ESM version of `three.js` with code from `examples/js`. Proper module files are located in `examples/jsm`.

It might be less error-prone to use a build tool instead of copy/past modules or library files into your project. A simple project setup with rollup looks like so: [GitHub - Mugen87/three-jsm: Minimal three.js project setup using ES6 modules and rollup.](https://github.com/Mugen87/three-jsm)

---

<div class="post-metadata">

**Author:** ![floko](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@floko](https://discourse.threejs.org/u/floko)\
**Post date:** [October 28, 2022, 12:28pm UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/6 "2022-10-28T12:28:05Z")

</div>

I will try your setup recommendations. Thanks a lot! 🙂

---

<div class="post-metadata">

**Author:** ![floko](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@floko](https://discourse.threejs.org/u/floko)\
**Post date:** [October 31, 2022, 8:42am UTC](https://discourse.threejs.org/t/arcballcontrols-js-throws-error-ambiguous-indirect-export-mathutils/44105/7 "2022-10-31T08:42:22Z")

</div>

Is there any structured way of copying and setting up the necessary files and folders manually?  
I tried above recommendations, but I neither have npm (command not found) nor node.js installed, no localhost server and I am working directly on a web server with somewhat limited permissions.  
Alternatively I tried taking the module files from examples/jsm for controls and loaders, combined with three.js (and later three.module.js) from /dev/build/. None of the combinations worked for me.  
Thank you!
