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

199
Vistas
How to make browser run module code first before normal text/javascript

How to make sure the script tag run in the order I define and also synchronously, because in the module I will import some other module remotely, and then use it later.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

<script defer="false" async="false" type="module">
    // will have import some module remotely here as well
    console.log('one');
</script>

<script defer="false" async="false" type="text/javascript">
    console.log('two');
</script>

<script defer="false" async="false" type="module">
    console.log('three');
</script>

<script defer="false" async="false" type="text/javascript">
    console.log('four');
</script>

</body>
</html>

Console Output:

two
four
one
three

My finding is the engine will run all the vanilla script in order first then only run the module script in order. How can I change this behavior?

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