How to get a service worker to update?

I use sw-precache to create my service with the Polymer CLI build process, so it intends to update the hash of the updated files to signal that the cache needs to be updated. But my updated content is not replaced in the cache, so it gets the old version if I update ctrl + r, but the new version if I update ctrl + shift + r. The reason for this may be that my service worker is not updating.

This document states that

If there is even a difference in bytes in the working user's file compared to what he currently has, he considers this new.

but what if my new service worker did not change the byte? (how does this happen if only one hash has changed). How to configure sw-precache to update the service with every new request?

+4
source share
3 answers

If the hash of the file has changed, this is enough to ensure that the support JavaScript file generated by using sw-precacheis changed. This, in turn, is enough to trigger a stream of service employee updates.

, , , JavaScript HTTP, , .

. fooobar.com/questions/229561/... , HTTP , .

+7

, 1- (24-) , , .update() ServiceWorkerRegistration .

Chrome "Empty Cache and Hard Reset" ( , ) script.

+3

'sw-precache' Workbox, , , ( , sw-precache, , ). - , , - - , , " ".

(ctrl-r) , -. , " " . , , .

(shift-ctrl-r) itll , .

devtools, , .

+3

Source: https://habr.com/ru/post/1668045/


All Articles