# \#modules

**URL:** https://discourse.threejs.org/tag/modules/19.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Error on Android devices - Failed to resolve module specifier three](https://discourse.threejs.org/t/error-on-android-devices-failed-to-resolve-module-specifier-three/75607)

<div class="topic-metadata">

**Author:** [@Alex74](https://discourse.threejs.org/u/Alex74)\
**Replies:** 1\
**Last updated:** [December 24, 2024, 1:35pm UTC](https://discourse.threejs.org/t/error-on-android-devices-failed-to-resolve-module-specifier-three/75607 "2024-12-24T13:35:58Z")

</div>

Hello! There was a problem, some Android devices work fine, and some display the error Failed to resolve module specifier “three”. Relative references must start with either “/”, “./”, or “…/”. How to fix this? Connecti…

---

## [ES6 modules + other THREE libraries](https://discourse.threejs.org/t/es6-modules-other-three-libraries/17500)

<div class="topic-metadata">

**Author:** [@phxbf](https://discourse.threejs.org/u/phxbf)\
**Replies:** 23\
**Last updated:** [December 19, 2024, 8:18am UTC](https://discourse.threejs.org/t/es6-modules-other-three-libraries/17500 "2024-12-19T08:18:47Z")

</div>

So, I’ve already searched through such topic and I’m putting my hands on ES6 modules. As far as I understand, THREE will deprecate non-ES6 modules approaches in the near future (?), so that’s a good reason to embrace th…

---

## [Cannot use import statement outside a module](https://discourse.threejs.org/t/cannot-use-import-statement-outside-a-module/21676)

<div class="topic-metadata">

**Author:** [@Johnatan](https://discourse.threejs.org/u/Johnatan)\
**Replies:** 4\
**Last updated:** [June 7, 2024, 9:39pm UTC](https://discourse.threejs.org/t/cannot-use-import-statement-outside-a-module/21676 "2024-06-07T21:39:11Z")

</div>

I’m trying to set up a simple Template for thee js but I get: “Cannot use import statement outside a module” My index.html: \<body\> \<div id= "container" \>\</div\> \<script src="app.js"\>\</script\> \</body\> A…

---

## [Error: Relative references must start with either "/", "./", or "../"](https://discourse.threejs.org/t/error-relative-references-must-start-with-either-or/13573)

<div class="topic-metadata">

**Author:** [@sleaper](https://discourse.threejs.org/u/sleaper)\
**Replies:** 22\
**Last updated:** [April 13, 2024, 7:15am UTC](https://discourse.threejs.org/t/error-relative-references-must-start-with-either-or/13573 "2024-04-13T07:15:45Z")

</div>

Hi guys, I am just begginer and I have this error code: Uncaught TypeError: Failed to resolve module specifier “three”. Relative references must start with either “/”, “./”, or “…/”. Do you know what am I doing w…

---

## [\[SOLVED\] Importmaps broken on Firefox... which now supports Importmaps?](https://discourse.threejs.org/t/solved-importmaps-broken-on-firefox-which-now-supports-importmaps/48413)

<div class="topic-metadata">

**Author:** [@whycobb](https://discourse.threejs.org/u/whycobb)\
**Replies:** 7\
**Last updated:** [March 24, 2024, 11:29pm UTC](https://discourse.threejs.org/t/solved-importmaps-broken-on-firefox-which-now-supports-importmaps/48413 "2024-03-24T23:29:03Z")

</div>

For future reference: Set up your importmaps ASAP in Firefox. It can break if you have too many other scripts that load first. Howdy, I’m building a page that renders a simple Three.JS scene, and it works great in Edge…

---

## [Angular v17 browser-esbuild cannot use modules from \`examples/jsm/..\`](https://discourse.threejs.org/t/angular-v17-browser-esbuild-cannot-use-modules-from-examples-jsm/60481)

<div class="topic-metadata">

**Author:** [@MarekDzw](https://discourse.threejs.org/u/MarekDzw)\
**Replies:** 2\
**Last updated:** [January 18, 2024, 8:31pm UTC](https://discourse.threejs.org/t/angular-v17-browser-esbuild-cannot-use-modules-from-examples-jsm/60481 "2024-01-18T20:31:27Z")

</div>

Hi, So currently building an app with new Angular builder browser-esbuild there are errors thrown that files imported from three/examples/jsm cannot be used. Is there any chance to change them to esmodules or any other …

---

## [How to Host Online Properly](https://discourse.threejs.org/t/how-to-host-online-properly/59678)

<div class="topic-metadata">

**Author:** [@oldboy](https://discourse.threejs.org/u/oldboy)\
**Replies:** 4\
**Last updated:** [December 31, 2023, 7:54am UTC](https://discourse.threejs.org/t/how-to-host-online-properly/59678 "2023-12-31T07:54:02Z")

</div>

I have never hosted a ThreeJS project before. I read the documentation, but it merely says to host the files. No detail beyond this was provided. When building and testing, I was using the following code: \<script a…

---

## [How to use camera movement with arrow keys in editor](https://discourse.threejs.org/t/how-to-use-camera-movement-with-arrow-keys-in-editor/58074)

<div class="topic-metadata">

**Author:** [@SILVERSTOCK](https://discourse.threejs.org/u/SILVERSTOCK)\
**Replies:** 2\
**Last updated:** [November 13, 2023, 10:13pm UTC](https://discourse.threejs.org/t/how-to-use-camera-movement-with-arrow-keys-in-editor/58074 "2023-11-13T22:13:35Z")

</div>

I am trying to get my camera to move when I press keys on my keyboard, I am aware of how to do this through an outside installation of three, but I prefer the editor, because I have a cheap computer, with low memory, and…

---

## [It looks like the browser can't recognizing the modules. (script type=importmap & module)](https://discourse.threejs.org/t/it-looks-like-the-browser-cant-recognizing-the-modules-script-type-importmap-module/57810)

<div class="topic-metadata">

**Author:** [@tt\_San](https://discourse.threejs.org/u/tt_San)\
**Replies:** 2\
**Last updated:** [November 7, 2023, 5:19am UTC](https://discourse.threejs.org/t/it-looks-like-the-browser-cant-recognizing-the-modules-script-type-importmap-module/57810 "2023-11-07T05:19:57Z")

</div>

Hey there! I want to use the three.js library with a web builder platform similar to Webflow (I must load it via CDN). However, it seems like I can’t load the script type=importmap and script type=module on this platform…

---

## [OutputPass.js not working on Website](https://discourse.threejs.org/t/outputpass-js-not-working-on-website/57623)

<div class="topic-metadata">

**Author:** [@miauwz.visualz](https://discourse.threejs.org/u/miauwz.visualz)\
**Replies:** 6\
**Last updated:** [November 1, 2023, 7:22am UTC](https://discourse.threejs.org/t/outputpass-js-not-working-on-website/57623 "2023-11-01T07:22:51Z")

</div>

Hi! Maybe someone has a clue what could be the problem: I have two passes for rendering (SAOPass, BokehPass) and use them with EffectComposer and OutputPass. Everything works fine on my local preview (in visual studio c…

---

## [How to use addons in Threejs](https://discourse.threejs.org/t/how-to-use-addons-in-threejs/57514)

<div class="topic-metadata">

**Author:** [@Wreewan\_Morhee](https://discourse.threejs.org/u/Wreewan_Morhee)\
**Replies:** 3\
**Last updated:** [October 29, 2023, 10:29am UTC](https://discourse.threejs.org/t/how-to-use-addons-in-threejs/57514 "2023-10-29T10:29:32Z")

</div>

In some code I will see: import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; from ‘three/addons/…’ but there is no t…

---

## [Why my import \* as THREE from \*three\* didn't work?](https://discourse.threejs.org/t/why-my-import-as-three-from-three-didnt-work/16048)

<div class="topic-metadata">

**Author:** [@Alyne\_do\_Nascimento](https://discourse.threejs.org/u/Alyne_do_Nascimento)\
**Replies:** 16\
**Last updated:** [October 27, 2023, 2:47pm UTC](https://discourse.threejs.org/t/why-my-import-as-three-from-three-didnt-work/16048 "2023-10-27T14:47:06Z")

</div>

I need to use three.js to do my school work and when I try run the code, appear nothing. I already did npm install --global webpack npm install --global webpack-cli and put my server to run this is my code: \<head\> …

---

## [Installing lil-gui](https://discourse.threejs.org/t/installing-lil-gui/37092)

<div class="topic-metadata">

**Author:** [@bob1942](https://discourse.threejs.org/u/bob1942)\
**Replies:** 4\
**Last updated:** [October 19, 2023, 9:35pm UTC](https://discourse.threejs.org/t/installing-lil-gui/37092 "2023-10-19T21:35:20Z")

</div>

Low-skilled user needs help, again: I’ve scanned the two main references for the new user interface lil-gui (GitHub - georgealways/lil-gui: Makes a floating panel for controllers on the web. Works as a drop-in replaceme…

---

## [I cant add or import orbit controls to my project](https://discourse.threejs.org/t/i-cant-add-or-import-orbit-controls-to-my-project/55942)

<div class="topic-metadata">

**Author:** [@Hamto887](https://discourse.threejs.org/u/Hamto887)\
**Replies:** 10\
**Last updated:** [September 13, 2023, 7:23pm UTC](https://discourse.threejs.org/t/i-cant-add-or-import-orbit-controls-to-my-project/55942 "2023-09-13T19:23:40Z")

</div>

So im completely new to coding but i wanted to make a small gltf model viewer for my 3d model. I want to try to make the scene moveable with orbit controls but im not cappable to add it with my little knowledge of coding…

---

## [Import \* as THREE from 'three';](https://discourse.threejs.org/t/import-as-three-from-three/55268)

<div class="topic-metadata">

**Author:** [@Celine\_Wunde](https://discourse.threejs.org/u/Celine_Wunde)\
**Replies:** 4\
**Last updated:** [August 23, 2023, 4:54pm UTC](https://discourse.threejs.org/t/import-as-three-from-three/55268 "2023-08-23T16:54:58Z")

</div>

I have installed three.js through nom but when I use the statement Import \* as THREE from ‘three’; I get a TypeError message saying 'failed to resolve module specifier “three”. Relative reference must start with either “…

---

## [How are these names being resolved?](https://discourse.threejs.org/t/how-are-these-names-being-resolved/54353)

<div class="topic-metadata">

**Author:** [@oldman](https://discourse.threejs.org/u/oldman)\
**Replies:** 1\
**Last updated:** [July 28, 2023, 12:25am UTC](https://discourse.threejs.org/t/how-are-these-names-being-resolved/54353 "2023-07-28T00:25:02Z")

</div>

I know this is a rather basic question. Please forgive. I have some lines of code in a three javascript function like this: import { Brush, Evaluator, ADDITION, SUBTRACTION, INTERSECTION, DIFFERENCE, } …

---

## [GLTFLoader is not a constructor](https://discourse.threejs.org/t/gltfloader-is-not-a-constructor/54111)

<div class="topic-metadata">

**Author:** [@samk99](https://discourse.threejs.org/u/samk99)\
**Replies:** 8\
**Last updated:** [July 20, 2023, 4:51am UTC](https://discourse.threejs.org/t/gltfloader-is-not-a-constructor/54111 "2023-07-20T04:51:17Z")

</div>

I am trying to use the Threejs library inside an environment that does not allow the use of npm or modules. Unfortunately it seems to me that my only option is to download the main library statically along with the GLTFL…

---

## [How to use DRACOLoader with GLTFLoader with bare module imports?](https://discourse.threejs.org/t/how-to-use-dracoloader-with-gltfloader-with-bare-module-imports/16748)

<div class="topic-metadata">

**Author:** [@gkjohnson](https://discourse.threejs.org/u/gkjohnson)\
**Replies:** 24\
**Last updated:** [July 7, 2023, 3:53pm UTC](https://discourse.threejs.org/t/how-to-use-dracoloader-with-gltfloader-with-bare-module-imports/16748 "2023-07-07T15:53:26Z")

</div>

I’m working on a package that depends on three.js (specifically 3dTilesRendererJS) and it needs to load GLTF files itself, some of which depend on DRACO compression. My question is – is there a recommended process by wh…

---

## [Looking for a way to import modules dynamically](https://discourse.threejs.org/t/looking-for-a-way-to-import-modules-dynamically/53389)

<div class="topic-metadata">

**Author:** [@Mr\_Weird](https://discourse.threejs.org/u/Mr_Weird)\
**Replies:** 22\
**Last updated:** [July 1, 2023, 10:37pm UTC](https://discourse.threejs.org/t/looking-for-a-way-to-import-modules-dynamically/53389 "2023-07-01T22:37:09Z")

</div>

Hello three.js heroes I should probably start with the fact that I use Three.js in an unusual way The lib code is inside the script element, without any src attributes, directly. Don’t ask why, it just has to work thi…

---

## [Where is the "three" location?](https://discourse.threejs.org/t/where-is-the-three-location/53375)

<div class="topic-metadata">

**Author:** [@oldman](https://discourse.threejs.org/u/oldman)\
**Replies:** 12\
**Last updated:** [June 30, 2023, 11:39am UTC](https://discourse.threejs.org/t/where-is-the-three-location/53375 "2023-06-30T11:39:12Z")

</div>

Forgive me for this really foolish question. Every project code starts off with import \* as THREE from 'three'; Where is this ‘three’ location in a typical development environment? OLDMAN

---

## [Import \* as THREE from “three” throws console error](https://discourse.threejs.org/t/import-as-three-from-three-throws-console-error/53129)

<div class="topic-metadata">

**Author:** [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)\
**Replies:** 6\
**Last updated:** [June 22, 2023, 6:05pm UTC](https://discourse.threejs.org/t/import-as-three-from-three-throws-console-error/53129 "2023-06-22T18:05:12Z")

</div>

I’ve had some sorta issue with my website where it says line one is wrong is some way… I’m using an import map…but I don’t think that’s the issue…help would be appreciated.

---

## [Interactive 3D Simulations for school physics at https://effectuall.github.io/](https://discourse.threejs.org/t/interactive-3d-simulations-for-school-physics-at-https-effectuall-github-io/52280)

<div class="topic-metadata">

**Author:** [@Effectual\_Learning](https://discourse.threejs.org/u/Effectual_Learning)\
**Replies:** 4\
**Last updated:** [June 5, 2023, 4:23am UTC](https://discourse.threejs.org/t/interactive-3d-simulations-for-school-physics-at-https-effectuall-github-io/52280 "2023-06-05T04:23:21Z")

</div>

Hello, I have created interactive simulation in 3D using three.js. There are presently mainly for topics in school physics. https://effectuall.github.io/

---

## [WARNING: Multiple instances of Three.js being imported. (?)](https://discourse.threejs.org/t/warning-multiple-instances-of-three-js-being-imported/24191)

<div class="topic-metadata">

**Author:** [@DatsGabs](https://discourse.threejs.org/u/DatsGabs)\
**Replies:** 4\
**Last updated:** [May 11, 2023, 3:04am UTC](https://discourse.threejs.org/t/warning-multiple-instances-of-three-js-being-imported/24191 "2023-05-11T03:04:20Z")

</div>

Why is this showing in the console when I import three.module.js and OrbitControls.js Literally this 2 lines of code. \<script type="module"\> import \* as THREE from 'https://unpkg.com/three/build/three.module.js'; …

---

## [Sharing Variables/Data between Program and Modules](https://discourse.threejs.org/t/sharing-variables-data-between-program-and-modules/44437)

<div class="topic-metadata">

**Author:** [@phil\_crowther](https://discourse.threejs.org/u/phil_crowther)\
**Replies:** 11\
**Last updated:** [May 22, 2023, 6:42pm UTC](https://discourse.threejs.org/t/sharing-variables-data-between-program-and-modules/44437 "2023-05-22T18:42:32Z")

</div>

One of the challenges of switching to modules was defining variables that both the main program and module could use. The solution that seemed to work was to have my program import a simple file with all the shared vari…

---

## [Trying To Import glb File From Blender](https://discourse.threejs.org/t/trying-to-import-glb-file-from-blender/50826)

<div class="topic-metadata">

**Author:** [@mickmedical](https://discourse.threejs.org/u/mickmedical)\
**Replies:** 1\
**Last updated:** [April 25, 2023, 8:53pm UTC](https://discourse.threejs.org/t/trying-to-import-glb-file-from-blender/50826 "2023-04-25T20:53:27Z")

</div>

Hello! I am a beginner to say the least. I am trying to import some objects i created in Blender. I am 99% sure my path locations are correct. I keep getting this error using my local host; caught TypeError: Failed to r…

---

## [How to import GLTFLoader in umd library](https://discourse.threejs.org/t/how-to-import-gltfloader-in-umd-library/50714)

<div class="topic-metadata">

**Author:** [@CodeSkool](https://discourse.threejs.org/u/CodeSkool)\
**Replies:** 1\
**Last updated:** [April 21, 2023, 8:53pm UTC](https://discourse.threejs.org/t/how-to-import-gltfloader-in-umd-library/50714 "2023-04-21T20:53:51Z")

</div>

I cannot use import statements in my project, how to import GLTFLoader in my project. this does not work: const GLTFLoader = require(‘three/examples/jsm/loaders/GLTFLoader.js’); and there is no js directory const GLT…

---

## [The examples/js directory will be removed with r148](https://discourse.threejs.org/t/the-examples-js-directory-will-be-removed-with-r148/45349)

<div class="topic-metadata">

**Author:** [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Replies:** 49\
**Last updated:** [April 20, 2023, 4:45am UTC](https://discourse.threejs.org/t/the-examples-js-directory-will-be-removed-with-r148/45349 "2023-04-20T04:45:14Z")

</div>

three.js is going to remove its examples/js directory in the next release r148. That means addons like GLTFLoader or OrbitControls will only be available as ES6 modules in the examples/jsm directory. What does that mean…

---

## [How do you do to work with external js classes files and put this on a main.js file with modules?](https://discourse.threejs.org/t/how-do-you-do-to-work-with-external-js-classes-files-and-put-this-on-a-main-js-file-with-modules/26564)

<div class="topic-metadata">

**Author:** [@espace3d](https://discourse.threejs.org/u/espace3d)\
**Replies:** 11\
**Last updated:** [April 17, 2023, 12:27am UTC](https://discourse.threejs.org/t/how-do-you-do-to-work-with-external-js-classes-files-and-put-this-on-a-main-js-file-with-modules/26564 "2023-04-17T00:27:28Z")

</div>

Hi, My application seems like that : ├── index.html └── main.js My main.js load module like this : import \* as THREE from "https://threejs.org/build/three.module.js"; import { OrbitControls } from "https://threejs.o…

---

## [Import CustomShaderMaterial](https://discourse.threejs.org/t/import-customshadermaterial/49498)

<div class="topic-metadata">

**Author:** [@hermann](https://discourse.threejs.org/u/hermann)\
**Replies:** 1\
**Last updated:** [March 24, 2023, 12:27pm UTC](https://discourse.threejs.org/t/import-customshadermaterial/49498 "2023-03-24T12:27:21Z")

</div>

There is a line, it is: import CustomShaderMaterial from 'three-custom-shader-material/vanilla' When I run it I get error: Uncaught TypeError: The specifier “three-custom-shader-material/vanilla” was a bare specifier,…

---

## [Importing and Using BufferGeometryUtils](https://discourse.threejs.org/t/importing-and-using-buffergeometryutils/39767)

<div class="topic-metadata">

**Author:** [@Shauncoree](https://discourse.threejs.org/u/Shauncoree)\
**Replies:** 2\
**Last updated:** [March 23, 2023, 1:07pm UTC](https://discourse.threejs.org/t/importing-and-using-buffergeometryutils/39767 "2023-03-23T13:07:18Z")

</div>

Can someone explain how to properly use BufferGeometryUtils? I get this error - export ‘BufferGeometryUtils’ (imported as ‘THREE’) was not found in ‘three’ I am importing using import \* as BufferGeometryUtils from “thr…

[Next page](https://discourse.threejs.org/tag/modules/19.md?match_all_tags=true&page=1&tags%5B%5D=modules)
