title: ERROR Error: Uncaught (in promise): TypeError: Failed to register a ServiceWorker
body: <p>We have a PWA that has been working fine for a long time, but now it seems the app is having trouble registering the service worker. We are using Angular 7 and the <code>ngsw-worker.js</code> is not output in the build folder. The error in the console is:</p>
  
  <blockquote>
    <p>ERROR Error: Uncaught (in promise): TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.</p>
  </blockquote>
  
  <p>We are registering the service worker in <code>core.module.ts</code> like this:</p>
  
  <pre><code>ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
  </code></pre>
  
  <p>Our ngsw-config.json look like this:</p>
  
  <pre><code>{
    "index": "/index.html",
    "assetGroups": [
      {
        "name": "app",
        "installMode": "prefetch",
        "resources": {
          "files": [
            "/favicon.ico",
            "/index.html",
            "/*.css",
            "/*.js"
          ]
        }
      }, {
        "name": "assets",
        "installMode": "lazy",
        "updateMode": "prefetch",
        "resources": {
          "files": [
            "/assets/**"
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>Is the <code>ngsw-worker.js</code> file supposed to be output explicitly in the dist folder, or is it part of the bundle?</p>