Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda