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

144
Visualizações
How does Webpack 4 allow chunks to load asynchronously?

According to this logbook entry, each javascript chunk pushes the arguments into webpackjsonp, an array, which is then processed by 'runtime'. If the chunk containing runtime runs before the other chunks have yet to push into the array, won't it be unable to process the chunks?

Additional info:
I have a website built with Angular, using the Angular build feature. Angular uses Webpack to bundle up all the javascript and the result is that the website only has four pairs of scripts (aside from the Cloudflare ones). Each of the scripts are inserted at the bottom of the website in the form <script src="scriptname.js" type="module"> These are two versions of main.js, polyfills.js, vendor.js and runtime.js, the same ones noted in this question (except I have two of each due to the differential loading stated in the answer).

For the scripts in ES2018, all of them are in the form (window.webpackJsonp = window.webpackJsonp || []).push([...]), except runtime.js, which is a IIFE. I presume that since runtime.js is an IIFE its the one in charge of processing the scripts (and indeed, its the only one that explicitly iterates over webpackjsonp. However, I don't really understand what's stopping runtime from running before the chunks are pushed into webpackjsonp. (In addition, when checking the request call stack, main.js is at the bottom, seemingly calling runtime.js, which then starts the other calls. I don't understand how this works either).

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