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

216
Visualizações
importing a javascript module

I'm trying to develop javascript that uses the three.js package, and I'm stuck at an early step of trying to import a module. In the html, I have

<script src="main.mj"></script>

And then in main.js I have

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

But, my browser won't load the page, giving the error "Uncaught SyntaxError: Cannot use import statement outside a module". If I change the html code to read

<script src="main.mj" type=module></script>

Then I get

"Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec."

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

I am pretty new to javascript, and I'd appreciate any advice. I'm editing on a local maching running an nginx webserver on localhost.

about 4 years ago · Juan Pablo Isaza
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