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

189
Vistas
Javascript: Infinite loop for import and script type error

I'm running a website on localhost:8000 and I'm currently in an infinite loop for fixing this problem. This is the line for using the javascript file in my html file:

    <script type="text/javascript" src="./scripts/main.js"></script>

I set the type to "text/javascript" because I got this error: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". According to this post I had to change type="module" to type="text/javascript", which fixed the error indeed, but then I got a new error: Uncaught SyntaxError: Cannot use import statement outside a module. According to this post I need to use type="module" and now I'm in a infinite loop.

package.json:

{
    ...
    "main": "main.js",
    "type": "module",
    ...

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If the console no longer throws a module related error, I'd guess that the infinite loop problem is related to the code itself.

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