Uncaught (in promise): Error: Loading chunk 20 failed

Has anyone else in this thread been able to try hash locationStrategy and see if it makes a difference? I assume this may help because of the difference in how the browser (ionic web view) treats URLs with or without hashes and does or does not trigger proper full loading of cached content.

From the reports I get from the users there is high probability the issue only happens after the app is run the first time after being updated from the App Store, so it does seem to be connected with cached content not being updated when it should. Unfortunately I am unable to reproduce this issue myself to be able to diagnose it properly.

In app.module.ts

    IonicModule.forRoot(MyApp, {
      locationStrategy: 'hash'
    }),

However this is the default.
I use this in the mobile app, and strategy ‘path’ in the browser app.

@bvamos got it, thanks. Have you seen this error since changing back to hash straregy?

@bvamos Did the ‘hash’ locationStrategy solve the Loading chunk failed issues?

We are getting this error a lot in Sentry (from users accessing the app in the browser).

Did anyone find the solution (did the 'hash" setting have any effect) ?

i could not found any other solution finally i changed

from this
loadChildren:()=>import('../home/home.module').then(m=>m.HomeModule)

to this
loadChildren: '../home/home.module#HomeModule'

2 Likes

Well. I’ve been working on this error for 24 hours. There was no problem in my development environment (desktop browser) but when i try it with device (IOS) i got that ChunkLoadError error without detail.

"name":“ChunkLoadError”,“type”:“missing”,“request” …

I tried everything I read but got no results. Ten minutes ago i changed browser from Chrome to Safari on desktop. I got the same error with Safari BUT with an extra detail, SyntaxError:

ChunkLoadError: Loading chunk pages-payment-payment-module failed.
(missing: http://localhost:8100/pages-payment-payment-module.js)

SyntaxError: Invalid regular expression: invalid group specifier name

Just because of Safari didn’t like my regex, I’ve been crazy for two days.

So if you got this error on IOS and u don’t use Safari on desktop, try it.

1 Like