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

233
Visualizações
How do I avoid all deferred scripts being evaluated and compiled in one single task causing a long task on the main thread?

It seems that using defer on scripts causes all of these scripts to be evaluated compiled and executed at once meaning in one single task before the DOMContentLoaded event.

This means if you or I have in my case a few of these scripts that are fairly slow to be executed, the task can become long and degrade the performance and Core Web Vitals of the page.

Most of these script depend on each other or at least should be executed in order, that's why the goto strategy was to use defer but I didn't know about the result of them being executed in a single task.

My plan is to insert some of them with JS when the DOMContentLoaded is fired, but this means that unless I preload them, they'll start to be downloaded much later. The end result is different than simply using defer.

Is there any way of breaking up that one long task or avoiding all of the deferred scripts being 'done' in one task?

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