[Solved] Argh! Safari -- ChunkLoadError!

My app didn’t work on iPad – in a fit of brilliance I decided to try Safari on my mac (rarely use it there) and boom!

Unhandled Rejection (ChunkLoadError): Loading chunk 2 failed.
(missing: http://localhost:8910/static/js/2.chunk.js)

Sigh, and things were going so well…

I found this – GitHub - mattlewis92/webpack-retry-chunk-load-plugin: A webpack plugin to retry loading of chunks that failed to load

Now to figure out how to add it…

Aaaaaaand it’s already in there…

Looking elsewhere…

OK…

The error before the error…

Screen Shot 2021-07-25 at 12.52.12 PM

Ok…

When my app is built and running on Safari (ios or mac) the regex in the getImageMime function causes an exception

Which is “very helpfully” handled by Safari when it throws an Exception and reports Unhandled Rejection (ChunkLoadError): Loading chunk 2 failed. (missing: http://localhost:8910/static/js/2.chunk.js)

After a lot of digging and debugging I found this: SyntaxError: Invalid regular expression: invalid group specifier name (anonymous function) — 2.chunk.js:240

Which tracks back to this

Doctor, I don’t know what to do – it hurts everywhere I touch !!

[Doctor] You’ve got a broken finger…

ref: