title: Service worker update not working?
body: <p>I have a nginx hosted Jekyll site.</p>
  
  <p>I have made several changes to my site, update package version and changed my javascript to update the service worker. However my changes are still not reflecting in chrome;</p>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw.js', {scope: 'sw-test'}).then(function(registration) {
  // registration worked
  console.log('Registration succeeded.');
      registration.update();
  }).catch(function(error) {
  // registration failed
  console.log('Registration failed with ' + error)
   });
  }
  </code></pre>
  
  <p><strong>sw.js</strong></p>
  
  <pre><code>var PRECACHE = 'precache-{{site.version}}';
  var RUNTIME = 'runtime';
  
  // A list of local resources we always want to be cached.
  var PRECACHE_URLS = [
      './',
      '/index.html',
      '/assets/css/main.css',
      '/assets/js/vendor/modernizr-custom.js',
      '/assets/js/bundle.js'
  ];
  
  // The install handler takes care of precaching the resources we always need.
  self.addEventListener('install', event =&gt; {
    event.waitUntil(
      caches.open(PRECACHE)
        .then(cache =&gt; cache.addAll(PRECACHE_URLS))
        .then(self.skipWaiting())
    );
  });
  
  // The activate handler takes care of cleaning up old caches.
  self.addEventListener('activate', event =&gt; {
    var currentCaches = [PRECACHE, RUNTIME];
    event.waitUntil(
      caches.keys().then(cacheNames =&gt; {
        return cacheNames.filter(cacheName =&gt; !currentCaches.includes(cacheName));
      }).then(cachesToDelete =&gt; {
        return Promise.all(cachesToDelete.map(cacheToDelete =&gt; {
          return caches.delete(cacheToDelete);
        }));
      }).then(() =&gt; self.clients.claim())
    );
  });
  
  // The fetch handler serves responses for same-origin resources from a cache.
  // If no response is found, it populates the runtime cache with the response
  // from the network before returning it to the page.
  self.addEventListener('fetch', event =&gt; {
    // Skip cross-origin requests, like those for Google Analytics.
    if (event.request.url.startsWith(self.location.origin)) {
      event.respondWith(
        caches.match(event.request).then(cachedResponse =&gt; {
          if (cachedResponse) {
            return cachedResponse;
          }
  
          return caches.open(RUNTIME).then(cache =&gt; {
            return fetch(event.request).then(response =&gt; {
              // Put a copy of the response in the runtime cache.
              return cache.put(event.request, response.clone()).then(() =&gt; {
                return response;
              });
            });
          });
        })
      );
    }
  });
  </code></pre>
  
  <p><strong>Chrome Screenshot</strong> 
  <a href="https://i.stack.imgur.com/UOjJ6.png" rel="nofollow noreferrer">Screenshot</a></p>
  
  <p>Any help greatly appreciated!!</p>