2

I am using Angular 8 and lazy laoding feature to a website.

Some of the users are getting an error ‘Error: Uncaught (in promise): Error: Loading chunk 0 failed.’ when accessing the website on Microsoft Edge. The strange thing is this does not happen for all the user base. Also, Chrome and Firefox do not give this error at all.

Doing ‘Hard Refresh’ solve the problem for most of the user. However, that is not a feasible solution for us as we can’t reach out to all the users and ask them for a hard refresh.

While analyzing this error and reading over the internet, we found that this is a problem mostly occurs with the browser caching the initial chunk of the javascript. And when it gets the updated in future, some browsers fail to load the JS and errors out.

One solution is to write a Global Error handler that reloads the page of this error happens and pragmatically reset the cache. However, I think may potentially go in infinite looping if this error does not occur due to cache.

I went through most of the questions here and did not find a suitable solution. Did anyone face this issue? Can you guys help me to solve this problem or point me in a direction that can solve this?

Thanks in advance.

Ishwar Patil
  • 1,671
  • 3
  • 11
  • 19

0 Answers0