Service-worker did not install when I created a new app

Hi ,
I am looking to start ionic again. In this time I am just keen to make PWA app by ionic.
after year that I did not work with ionic , it is changed a lot.

I searched and found a short article in ionic’s blog which explains how I can make a PWA with an ionic developed application. ( you can find it here )

in the first step it asks to uncomment a part of about service-worker in src/index.html which does not exist.
I started a application with “tabs” template and I did not change anything in the app. I wanted just to find how PWA ionic is working.

Do you know how I can have an app which has “service-worker” ? or How I can add “service-worker” to the existed app ?

Hi

things in PWA world are changing rapidly. That original article does not apply anymore to Ionic 4, at least the way I see it.

Assuming Ionic-angular is your starting point, I see two easy options for PWA introduction to your app:

  • Use capacitor
  • Use angular (7+) PWA support using ng add @angular/pwa and everything that comes with it

Those options can’t mix.

Of course, feel free to do all the stuff manually using the Google PWA documentation. But that to me seems the hard way.

I think, if you can go Angular 8, I’d say it is better as there seems to be an issue in A7 related to the service worker not registering as the document is not stable - so you need to force it manually.

I am using @angular/pwa and it is definitely a huge improvement over the article you mentioned. Generation of manifest, resources and most of all: making sure when you redeploy the new app, it gets automagically updated. Immediate compliance with the PWA audit in Chrome (Lighthouse).

Can’t find a good article right now very fast, there is some stuff on the internet. But as I mentioned, it is moving fast, so before applying any guideline, be sure to check if the versions match etc.

Regards

Tom

Dear Tom,
Thank you for your quick and helpful reply.
I am considering your option and advices.

It seem if I use the old way ( developing hybrid app ) is better, at least now that PWA is not stable enough !

Best,
Ali

If Capacitor has the plugins you need, then that gives you the most freedom going to PWA afterwards