Updating the service worker file can be a tricky concept as well. There are several factors that determine when your service worker is updated. The update cycle does not start until the browser determines that there is a new service worker file available.
Once a service worker is registered, the browser treats the file like any other file when determining if there is a new version available. It makes a request to the server, which triggers a well-known cycle.
First, there is the local browser cache (not the service worker cache) for the file. If there is a local version available that has not become stale, it is retrieved. Next, the request is sent across the network to the server. If the server responds with a 304, it means that the browser has the most current version. If the file has not changed, then the service worker update cycle does not start. If...