Service workers issue in fetching the data
<p>I am using the below script to get the bootstrap.min.js file from the service workers but in network pannel it shows 1 request for bootstrap.min.js and all other requests it shows 2 request i have attached the screenshot, can somebody please help me to resolve this.</p>

<pre><code>var CACHE_VERSION = 8;

var CURRENT_CACHES = {
  prefetch: 'prefetch-cache-v' + CACHE_VERSION,
  font: 'font-cache-v' + CACHE_VERSION
};
</code></pre>

<p>//installing the service worker</p>

<pre><code>self.addEventListener('install', function(event) {
  var now = Date.now();

    var urlsToPrefetch = [
    '/themes/2.0/fluid/public/responsive/js/bootstrap.min.js'
    ];

    console.log('Handling install event. Resources to prefetch:', urlsToPrefetch);

    event.waitUntil(
        caches.open(CURRENT_CACHES.prefetch).then(function(cache) {
            var cachePromises = urlsToPrefetch.map(function(urlToPrefetch) {
                console.log("comes here23");
            var url = new URL(urlToPrefetch, location.href);
            url.search += (url.search ? '&amp;' : '?') + 'cache-bust=' + now;

            var request = new Request(url, {mode: 'no-cors'});

            return fetch(request).then(function(response) {
              if (response.status &gt;= 400) {
                throw new Error('request for ' + urlToPrefetch +' failed with status ' + response.statusText);
              }
              // Use the original URL without the cache-busting parameter as the key for cache.put().
              return cache.put(urlToPrefetch, response);
            }).catch(function(error) {
              console.error('Not caching ' + urlToPrefetch + ' due to ' + error);
            });
          });

          return Promise.all(cachePromises).then(function() {
            console.log('Pre-fetching complete.');
          });
        }).catch(function(error) {
        //  console.error('Pre-fetching failed:', error);
        })

    );
});
</code></pre>

<p>//fetching request from service worker</p>

<pre><code>self.addEventListener('fetch', function(event) {

  event.respondWith(


    caches.match(event.request).then(function(response) {
      if (response) {
        console.log("comes here", event.request);
        return response;
      }
      console.log("no cache exists");

      return fetch(event.request).then(function(response) {
        return response;
      }).catch(function(error) {

        throw error;
      });

    })

  );
});
</code></pre>

<p><a href="https://i.stack.imgur.com/Hyx3s.png" rel="nofollow"><img src="https://i.stack.imgur.com/Hyx3s.png" alt="Network"></a></p>