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

204
Visualizações
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 à 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