Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda