Service Worker loading stale / outdated cached files (cli 3.11.5 / sdk 35 and cli 3.11.7 / sdk 36)

Whenever I upload a new build to our server, any browser that had opened the previous version continues to use that version unless the cache is cleared, or a full refresh is triggered. Even then, refreshing normally after that will sometimes go back to the older version. This seems to trace back to the service worker. When an old version is erroneously loaded, the Chrome network log says it was served by the service worker. This sounds very similar to https://github.com/expo/web-examples/issues/60 which was supposed to be fixed in https://github.com/expo/expo-cli/pull/1082 but even after updating to cli 3.11.5, clearing all my browser data, making sure it always loads a version from after that updated build, and then doing another update, the problem persists.

This was on @expo/webpack-config@0.10.1, I just noticed there’s a newer version and it generates a different register-service-worker.js. I’ll report back if @expo/webpack-config@0.10.11 fixes the problem.

That did not fix anything. Even forcing the app to refresh if a newer version is detected on the server doesn’t work. Why does Expo use service workers anyway? Is there a way to NOT use service workers?

For what it’s worth, I’ve been running into the same problem and have been unsuccessful in fixing it. IMO, the default caching policies that Expo passes to Workbox for caching assets are way too aggressive for defaults.

This should have been fixed for a while now. I think the unfortunate nature of this error has caused any legacy service workers to remain registered. ⌘+shift+R or manually unregistering service workers should remove the legacy aggressive workers.

It continues even after unregistering the service workers. The new ones are just as aggressive.