Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How to import modules to threejs project correctly?

I'm trying to import modules so I can use the bloom effect, but I keep getting this error. The .js were copied from three/examples/js/ so they are up to date.

index.html:

<script src="../module/three.js";></script>
<script src="../module/EffectComposer.js"></script>
<script src="../module/CopyShader.js"></script>
<script src="../module/ShaderPass.js"></script>
<script src="../module/RenderPass.js"></script>
<script src="../module/UnrealBloomPass.js"></script>
<script src="../module/MaskPass.js"></script>
<script src="../module/Pass.js"></script>
<script src="../module/LuminosityHighPassShader.js"></script>
<script type="module" src="index.js"></script>

index.js:

import * as THREE from "../module/three.module.js";

...
//bloom renderer
const renderScene = new THREE.RenderPass(scene, camera);

and it results in the following error: Uncaught TypeError: THREE.RenderPass is not a constructor

How am I supposed to do it in the correct way?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are importing three.js twice. One time via script tag and another time via ES6 import statement. This is a wrong pattern and definitely needs to be prevented.

The ES6 import redefines the THREE namespace in your app and thus overwrites the previous imports via the script tag. So please delete the following line and try it again:

import * as THREE from "../module/three.module.js";
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!