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

382
Views
How to prevent downloading pre-defined webpack bundle chunks until a condition is met?

I have an react application which uses webpack(v5). In this application webpack SplitChunks plugin is used to split the bundle into multiple set of files. I have a requirement to stop loading some of the bundles until authentication happens. Because it is costly downloading unwanted js files for the auth check at that point, since if the auth is unsuccessful and it's having to http redirect the user to login page(Not developed using react).

Therefore since those chunks are added to index.html page as script tags in the project building phase, are there any ways that i can use to implement my requirement.

PS: At the moment there is an http event fired, when the auth is successful as well, which can also be used. Further the pre-defining the set of chunks can be done via wildcards, as hash is also added to the file names.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This has been tested by conditionally delaying out some chunks generated by the Webpack SplitChunks plugin. However, this breaks the app as all the chunks require for the app to function properly. The only option we can think of is code splitting and lazy loading.

Hope this will help someone experimenting with the same use case.

about 4 years ago · Juan Pablo Isaza Report
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!