# \#es6

**URL:** https://discourse.threejs.org/tag/es6/18.md

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

---

## [Failure to initiate any post-processing effect](https://discourse.threejs.org/t/failure-to-initiate-any-post-processing-effect/78557)

<div class="topic-metadata">

**Author:** [@MTSyntho](https://discourse.threejs.org/u/MTSyntho)\
**Replies:** 1\
**Last updated:** [February 23, 2025, 9:05pm UTC](https://discourse.threejs.org/t/failure-to-initiate-any-post-processing-effect/78557 "2025-02-23T21:05:27Z")

</div>

Hi! I am currently working on implementing post-processing into my game engine although Im currently struggling to get anything working. Ive created this new file, gzjs.postprocessing.js import \* as THREE from 'three';…

---

## [Setting up ES6 modules in a project](https://discourse.threejs.org/t/setting-up-es6-modules-in-a-project/76160)

<div class="topic-metadata">

**Author:** [@AURLab](https://discourse.threejs.org/u/AURLab)\
**Replies:** 0\
**Last updated:** [January 8, 2025, 2:20am UTC](https://discourse.threejs.org/t/setting-up-es6-modules-in-a-project/76160 "2025-01-08T02:20:08Z")

</div>

Hi, I’ve been working on an AR project, and I’ve come a long way since I started. I have my project set up in a more outdated way, with all the non-ES6 modules, and I consider it to be a bit disorganised. I was hoping i…

---

## [CDN es6 module import requires importmap (Vanilla JS)](https://discourse.threejs.org/t/cdn-es6-module-import-requires-importmap-vanilla-js/68353)

<div class="topic-metadata">

**Author:** [@jikkuatwork](https://discourse.threejs.org/u/jikkuatwork)\
**Replies:** 25\
**Last updated:** [July 21, 2024, 8:33am UTC](https://discourse.threejs.org/t/cdn-es6-module-import-requires-importmap-vanilla-js/68353 "2024-07-21T08:33:55Z")

</div>

Description I am trying to use threejs in a vanilla page using es6 imports. But its weird that the latest version doesn’t work without importmap! Weirdly an old version’s importmap also works! Check these examples: Ol…

---

## [Webpack cant resolve and point to my node\_modules](https://discourse.threejs.org/t/webpack-cant-resolve-and-point-to-my-node-modules/10477)

<div class="topic-metadata">

**Author:** [@haangglide](https://discourse.threejs.org/u/haangglide)\
**Replies:** 3\
**Last updated:** [September 7, 2022, 10:46am UTC](https://discourse.threejs.org/t/webpack-cant-resolve-and-point-to-my-node-modules/10477 "2022-09-07T10:46:43Z")

</div>

I have problems running the Three.js library as a module according to the manual https://threejs.org/docs/#manual/en/introduction/Import-via-modules I want to import three like this: import \* as THREE from 'three'; T…

---

## [Cannot import examples: "SyntaxError: Cannot use import statement outside a module"](https://discourse.threejs.org/t/cannot-import-examples-syntaxerror-cannot-use-import-statement-outside-a-module/16278)

<div class="topic-metadata">

**Author:** [@nearoo](https://discourse.threejs.org/u/nearoo)\
**Replies:** 4\
**Last updated:** [August 3, 2022, 7:24am UTC](https://discourse.threejs.org/t/cannot-import-examples-syntaxerror-cannot-use-import-statement-outside-a-module/16278 "2022-08-03T07:24:54Z")

</div>

I’m unable to use examples from three.js as described here. Importing from three like import { Mesh } from 'three' works fine, however e.g. import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader' always re…

---

## [Uncaught TypeError: SceneUtils.createMultiMaterialObject is not a constructor](https://discourse.threejs.org/t/uncaught-typeerror-sceneutils-createmultimaterialobject-is-not-a-constructor/28628)

<div class="topic-metadata">

**Author:** [@prominent](https://discourse.threejs.org/u/prominent)\
**Replies:** 2\
**Last updated:** [August 3, 2021, 10:57pm UTC](https://discourse.threejs.org/t/uncaught-typeerror-sceneutils-createmultimaterialobject-is-not-a-constructor/28628 "2021-08-03T22:57:42Z")

</div>

I’m trying to update to the latest version 131 from 126… Im getting an error though: Uncaught TypeError: SceneUtils.createMultiMaterialObject is not a constructor Here is my code. It works in v126, but not when updat…

---

## [Import EffectComposer](https://discourse.threejs.org/t/import-effectcomposer/28367)

<div class="topic-metadata">

**Author:** [@toniGallardo](https://discourse.threejs.org/u/toniGallardo)\
**Replies:** 3\
**Last updated:** [July 27, 2021, 1:53pm UTC](https://discourse.threejs.org/t/import-effectcomposer/28367 "2021-07-27T13:53:06Z")

</div>

I’m developing a site with Nuxt.js and I’m importing three.js from npm. It’s works fine, but when I try to import EffectComposer from the examples it’s give me this error, ‘Must use import to load ES Module.’ In fact non…

---

## [Is it ok to use ES6 template syntax for shaders?](https://discourse.threejs.org/t/is-it-ok-to-use-es6-template-syntax-for-shaders/22981)

<div class="topic-metadata">

**Author:** [@Nicholas\_Bilyk](https://discourse.threejs.org/u/Nicholas_Bilyk)\
**Replies:** 18\
**Last updated:** [January 31, 2021, 5:01pm UTC](https://discourse.threejs.org/t/is-it-ok-to-use-es6-template-syntax-for-shaders/22981 "2021-01-31T17:01:00Z")

</div>

I see that in the threejs shaders, there are include statements such as: \` #include \<common\> uniform float scale; \` I’m not trying to be too esoteric here, but I was wondering if anybody could think of a reason for m…

---

## [Rollup build setup to import glsl files and three.js examples](https://discourse.threejs.org/t/rollup-build-setup-to-import-glsl-files-and-three-js-examples/93)

<div class="topic-metadata">

**Author:** [@looeee](https://discourse.threejs.org/u/looeee)\
**Replies:** 4\
**Last updated:** [August 26, 2020, 8:50pm UTC](https://discourse.threejs.org/t/rollup-build-setup-to-import-glsl-files-and-three-js-examples/93 "2020-08-26T20:50:21Z")

</div>

This is a simplified version of the build setup that I use - its a modified version of the rollup.js setup that three.js uses, that compiles ES6 with babel, reads .glsl files that can contain glslify imports and allows i…

---

## [PointerLockController + ES6 / Rollup Boilerplate - issues resolved - now working](https://discourse.threejs.org/t/pointerlockcontroller-es6-rollup-boilerplate-issues-resolved-now-working/16162)

<div class="topic-metadata">

**Author:** [@Heiddo](https://discourse.threejs.org/u/Heiddo)\
**Replies:** 1\
**Last updated:** [June 12, 2020, 7:46pm UTC](https://discourse.threejs.org/t/pointerlockcontroller-es6-rollup-boilerplate-issues-resolved-now-working/16162 "2020-06-12T19:46:35Z")

</div>

I had issues implementing the pointerlockcontrols example into this boilerplate. The issue changed every hour and were all just typos that didn’t contain much to learn from and so I want to keep this cleaner. I still ha…

---

## [Some naive questions about ES6 - webpack - npm and best practice](https://discourse.threejs.org/t/some-naive-questions-about-es6-webpack-npm-and-best-practice/16030)

<div class="topic-metadata">

**Author:** [@Heiddo](https://discourse.threejs.org/u/Heiddo)\
**Replies:** 13\
**Last updated:** [June 11, 2020, 9:03pm UTC](https://discourse.threejs.org/t/some-naive-questions-about-es6-webpack-npm-and-best-practice/16030 "2020-06-11T21:03:46Z")

</div>

tl;dr - I’m confused about 'best practices in regards to ES6, npm, webpack, web hosting. Any guidance, advice or links to up to date learning are much appreciated. My first three.js project was thrown together with a mi…

---

## [Problems with ES6 Imports in threejs using node 14? (No Webpack or Babel)](https://discourse.threejs.org/t/problems-with-es6-imports-in-threejs-using-node-14-no-webpack-or-babel/15807)

<div class="topic-metadata">

**Author:** [@spikethea](https://discourse.threejs.org/u/spikethea)\
**Replies:** 3\
**Last updated:** [June 2, 2020, 11:06am UTC](https://discourse.threejs.org/t/problems-with-es6-imports-in-threejs-using-node-14-no-webpack-or-babel/15807 "2020-06-02T11:06:45Z")

</div>

(Posting this here because stackoverflow seemed to not have the answer, maybe because of the specifity of the environment.) Does anyone have problems with using ES6 Imports in three.js? this is without Webpack or Babel,…

---

## [ES6 import use with external link](https://discourse.threejs.org/t/es6-import-use-with-external-link/14004)

<div class="topic-metadata">

**Author:** [@reactor](https://discourse.threejs.org/u/reactor)\
**Replies:** 1\
**Last updated:** [April 1, 2020, 3:44pm UTC](https://discourse.threejs.org/t/es6-import-use-with-external-link/14004 "2020-04-01T15:44:31Z")

</div>

Is there a way to use a direct link in import tag like: import \* as THREE from ‘https://github.com/mrdoob/three.js/blob/38bf141e60239ffa56b8f32dba80c465711ac486/build/three.module.js’; If i run the script with this typ…

---

## [FBXLoader and es6 modules](https://discourse.threejs.org/t/fbxloader-and-es6-modules/6975)

<div class="topic-metadata">

**Author:** [@Magia](https://discourse.threejs.org/u/Magia)\
**Replies:** 4\
**Last updated:** [May 14, 2019, 5:42am UTC](https://discourse.threejs.org/t/fbxloader-and-es6-modules/6975 "2019-05-14T05:42:23Z")

</div>

Hi all, I wanna use three.js with my react application, but I still can’t to understand, how can I import FBXLoader, OBJLoader and etc. properly. Are there any tutorials or exemples?

---

## [Is the Line library available as an ES6 module?](https://discourse.threejs.org/t/is-the-line-library-available-as-an-es6-module/5956)

<div class="topic-metadata">

**Author:** [@dugla](https://discourse.threejs.org/u/dugla)\
**Replies:** 3\
**Last updated:** [January 31, 2019, 8:30pm UTC](https://discourse.threejs.org/t/is-the-line-library-available-as-an-es6-module/5956 "2019-01-31T20:30:56Z")

</div>

Hi. I am enjoying three.js a lot!. Super productive . Question: I do development using modern JS (ES6, webpack, etc.). I have a version of three.js in module form (cool). I have not been able to find a module form of the…

---

## [Import non module LineMaterial.js](https://discourse.threejs.org/t/import-non-module-linematerial-js/5257)

<div class="topic-metadata">

**Author:** [@vin-ni](https://discourse.threejs.org/u/vin-ni)\
**Replies:** 2\
**Last updated:** [December 14, 2018, 1:17pm UTC](https://discourse.threejs.org/t/import-non-module-linematerial-js/5257 "2018-12-14T13:17:29Z")

</div>

Hi, I’m using a bundler to build three.js and would like to add the LineMaterial.js. Unfortunately this isn’t an official module and I have no idea how to import it correctly (this is the first time i’m using a bundler)…

---

## [Mix modules and global definitions](https://discourse.threejs.org/t/mix-modules-and-global-definitions/806)

<div class="topic-metadata">

**Author:** [@NicolasRannou](https://discourse.threejs.org/u/NicolasRannou)\
**Replies:** 7\
**Last updated:** [December 1, 2017, 3:49pm UTC](https://discourse.threejs.org/t/mix-modules-and-global-definitions/806 "2017-12-01T15:49:52Z")

</div>

Hi, Is it in theory possible to mix modules and global THREEJS definitions? I have a JS library using THREEJS modules compiled with browserify but when I try to use it in a “regular” THREEJS app, it just makes weird th…

---

## [How to use a function references in another javascript file](https://discourse.threejs.org/t/how-to-use-a-function-references-in-another-javascript-file/612)

<div class="topic-metadata">

**Author:** [@s333](https://discourse.threejs.org/u/s333)\
**Replies:** 1\
**Last updated:** [July 15, 2017, 8:18am UTC](https://discourse.threejs.org/t/how-to-use-a-function-references-in-another-javascript-file/612 "2017-07-15T08:18:30Z")

</div>

I have a three js function defined in my utils.js file. in this file i have exported the function rmve like so: I have an index file that i then want to use this function in. How can i do this.

---

## [Ecmascript 6 support](https://discourse.threejs.org/t/ecmascript-6-support/460)

<div class="topic-metadata">

**Author:** [@migmacdev](https://discourse.threejs.org/u/migmacdev)\
**Replies:** 3\
**Last updated:** [June 10, 2017, 1:34am UTC](https://discourse.threejs.org/t/ecmascript-6-support/460 "2017-06-10T01:34:00Z")

</div>

Does threejs support ecmascript 6? (javascript), I'm interested in using javascript classes. Thanks in advance.
