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

197
Views
Error: THREE is not defined inside FBXLoader

I'm using the module version of three.js because I need to run imports from a client-side js file structure.

THREE itself works fine. But now I'm having the issue that I cannot use it in FBXLoader:

This is the import statement on my client-side rendering file:

import * as THREE from '/build/three.module.js';
import * as FBXLoader from '/js/loaders/FBXLoader.js';

This does not throw any errors.

Server-side, I'm using express to allow access to modules on client-side:

app.use(express.static(__dirname + '/public'));
app.use('/build/', express.static(path.join(__dirname, 'node_modules/three/build')));
app.use('/js/', express.static(path.join(__dirname, 'node_modules/three/examples/js')));

So far so good.

When I try to run, I get the following error:

Uncaught ReferenceError: THREE is not defined
    <anonymous> http://localhost:3000/js/loaders/FBXLoader.js:22
    <anonymous> http://localhost:3000/js/loaders/FBXLoader.js:3817

Any ideas what the problem is? There error is not in my code, this is something inside FBXLoader.js.

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

0

A file's imports are scoped to that file. It may be that FBXLoader.js isn't importing THREE and that's why it's undefined. Include in FBXLoader.js:

import * as THREE from '/build/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!