title: An unknown error occurred when fetching the script (Service Worker)
body: <p>When going offline, I get the following error by my service worker:</p>
  
  <p><code>(unknown) #3016 An unknown error occurred  when fetching the script</code></p>
  
  <p>my service worker looks like this:</p>
  
  <pre><code>var version = 'v1'
  
  this.addEventListener('install', function(event){
    event.waitUntil(
       caches.open(version).then(cache =&gt; {
         return cache.addAll([
           'https://fonts.googleapis.com/icon?family=Material+Icons',
           'https://fonts.googleapis.com/css?family=Open+Sans:400,600,300',
           './index.html'
         ])
       })
     )
  })
  
  this.addEventListener('fetch', function(event) {
    event.respondWith(
      caches.match(event.request).then(function(resp) {
        // if it's not in the cache, server the regular network request. And save it to the cache
        return resp || fetch(event.request).then(function(response) {
          return caches.open(version).then(function(cache) {
            cache.put(event.request, response.clone())
            return response
          })
        })
      })
    )
  })
  </code></pre>
  
  <p>It is at top level directory, right next to a manifest importing like this in index.html:</p>
  
  <p><code>&lt;link rel="manifest" href="/manifest.json"&gt;</code></p>
  
  <p>I import the service worker in my entry js file. And register it right after.</p>
  
  <pre><code>require('tether-manifest.json')
  import serviceWorker from 'sw'
  
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register(serviceWorker)
    .then(() =&gt; {
      // registration worked
    }).catch(error =&gt; {
      throw new Error(error)
    })
  }
  </code></pre>
  
  <p>It registers fine. I don't encounter the error until I go offline.</p>
  
  <p>I am using webpack with React, and doing the following in webpack to copy my sw.js file to the dist folder:</p>
  
  <pre><code>loaders: [
        { // Service worker
          test: /sw\.js$/,
          include: config.src,
          loader: 'file?name=[name].[ext]'
        },
        { // Manifest
          test: /manifest\.json$/,
          include: config.src,
          loader: 'file?name=[name].[ext]'
        }
  ]
  </code></pre>
  
  <p>The error doesn't give any information as to what is happening.</p>
  
  <p>Anyone have any idea how to fix this?</p>