1

I am making a Pwa with ionic

I wish to debug the service worker without running the command "ionic build --prod" each time i make a change ! So i wish to be able to load the service worker on localhost but i have this error :

Error TypeError: Failed to register a ServiceWorker for scope ('http://localhost:8100/') with script ('http://localhost:8100/service-worker.js'): A bad HTTP response code (404) was received when fetching the script.

The service-worker.js file is located in the "src" folder of my ionic app project

A possible answer to my problem here How to run service worker locally with Angular

  • 1
    Pretty much you answered yourself. You can't run the service worker locally without having to build the project and then use a library to run a local https server. Please read https://blog.angular-university.io/angular-service-worker/ – KingDarBoja Aug 23 '20 at 21:23
  • Thank you, I wish to debug my webapp before to compile and build it. I think about serving src folder from an external server than localhost because localhost is not https. Another possible answer : https://stackoverflow.com/questions/43492354/how-to-allow-access-outside-localhost – de albuquerque frank Aug 24 '20 at 08:22
  • I wish to run it from an external server hosting so i won't have to rebuild the app each time i make a change ! – de albuquerque frank Aug 24 '20 at 08:52
  • The solution i found is ngrok service it is serving from outside localhost – de albuquerque frank Aug 24 '20 at 14:59
  • You could host using firebase, the is a good tutorial on Ionic docs: https://ionicframework.com/docs/angular/pwa#deploying – KingDarBoja Aug 24 '20 at 16:24

0 Answers0