2

I am using code-splitting through react-loadable and service workers through offline-plugin. It works perfectly in chrome and firefox.

But it is not working properly on Safari. When I go to a different route, chunk js is loaded for that route and it comes from service-worker as expected but service-worker returns encrypted js (I guess) for eg: N��}���S������^+����

Safari version - 11.1.1 Same is happening in iOS Safari

Pranab Gupta
  • 350
  • 2
  • 10
  • We are also experiencing critical failures in Safari with the "`react-loadable`" library. Our problems do not involve service workers though, so know that you are not alone. Sadly, the project has disabled issues on GitHub, so we'll have to air our dirty laundry here. – Dawson B Jul 03 '18 at 18:18
  • @DawsonBotsford what problems are you facing with react-loadable? – Pranab Gupta Jul 03 '18 at 21:56
  • If we're using `react-loadable@5.4.0`, there is a difficult-to-debug issue in Safari where a chunked route will return a 504 and white page. It leaves the users with a confusing situation, I'm unsure if a page refresh returns them to a functional page. We've been unable to determine recreation steps to cause this, but reverting to `react-loadable@5.3.1` fixes everything. – Dawson B Jul 05 '18 at 15:20

1 Answers1

0

I was creating brotli and gzip compressed assets. But in service worker file, I was using brotli compressed assets path and since, brotli is not supported by Safari it was not able to decompress the assets.

To solve this, I created another service worker file(sw-legacy.js) and checked request headers for supported compression from browser(accept-encoding header) and returned respective file.

Pranab Gupta
  • 350
  • 2
  • 10