2

I've set up an universal and pwa app.

Is there a way to fix this error ?

You can see a DEMO (the first push :) ) https://blogial-client.herokuapp.com/

SERVER SIDE CONSOLE

ERROR { Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'ngsw_worker.es6.js.map'
Error: Cannot match any routes. URL Segment: 'ngsw_worker.es6.js.map'

CHROME CONSOLE

ERROR Error: Uncaught (in promise): SecurityError: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').

UPDATE

I worked it out with

ng add @angular/pwa --project *project-name*

I forgot the app name :(

Whisher
  • 31,320
  • 32
  • 120
  • 201

2 Answers2

1

I removed "//# sourceMappingURL=ngsw_worker.es6.js.map" from dist/appname/ngsw-worker.js and it's working.

It seems a bug.

Black Mamba
  • 13,632
  • 6
  • 82
  • 105
Stefano Cappa
  • 575
  • 3
  • 17
  • 1
    Thanks for the reply but with angular 6 I've not ngsw-worker.js file in my dist folder both server and browser – Whisher Jul 21 '18 at 20:59
1

All the above didn´t work for me.
What did work is to "unregister" the service worker on the browser.
It seems that a previous service worker for an app on the same url:port was the problem.

enter image description here

guillefd
  • 1,903
  • 1
  • 16
  • 26