Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!