title: Angular 7: ngsw-worker.js failed to load
body: <h2>Problem</h2>
  
  <p>There is a <em>universal</em> app that uses a <em>Service Worker</em>.</p>
  
  <p>Recently upgraded from <em>Angular 6.1</em> to <em>7</em>.</p>
  
  <p>After uploading the updated files to the server getting:</p>
  
  <p><a href="https://i.stack.imgur.com/B7uPf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B7uPf.png" alt="enter image description here"></a></p>
  
  <p>Details:</p>
  
  <p><code>
  The script has an unsupported MIME type ('text/html').
  Failed to load resource: net::ERR_INSECURE_RESPONSE
  main.2733b77522d2feee4713.js:1 ERROR Error: Uncaught (in promise): SecurityError: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').
      at j (polyfills.92108b287fe28032870b.js:1)
      at polyfills.92108b287fe28032870b.js:1
      at polyfills.92108b287fe28032870b.js:1
      at e.invoke (polyfills.92108b287fe28032870b.js:1)
      at Object.onInvoke (main.2733b77522d2feee4713.js:1)
      at e.invoke (polyfills.92108b287fe28032870b.js:1)
      at t.run (polyfills.92108b287fe28032870b.js:1)
      at polyfills.92108b287fe28032870b.js:1
      at e.invokeTask (polyfills.92108b287fe28032870b.js:1)
      at Object.onInvokeTask (main.2733b77522d2feee4713.js:1)
  Sr @ main.2733b77522d2feee4713.js:1
  t.handleError @ main.2733b77522d2feee4713.js:1
  ...
  (anonymous) @ main.2733b77522d2feee4713.js:1
  The script has an unsupported MIME type ('text/html').
  Failed to load resource: net::ERR_INSECURE_RESPONSE
  The script has an unsupported MIME type ('text/html').
  Failed to load resource: net::ERR_INSECURE_RESPONSE
  </code></p>
  
  <h2>SSL</h2>
  
  <p>Using a valid certificate generated by <a href="https://letsencrypt.org/" rel="nofollow noreferrer">https://letsencrypt.org/</a>.</p>
  
  <h2>Chrome Security</h2>
  
  <p><a href="https://i.stack.imgur.com/AK5ZX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AK5ZX.png" alt="enter image description here"></a></p>