ionic 3 publish app as PWA (Progressive Web App)

Viewed 13720

I want to publish my app as PWA so what i did is

insert this script to index.html

<!--script>
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('service-worker.js')
        .then(() => console.log('service worker installed'))
        .catch(err => console.log('Error', err));
    }
</script-->

then install

npm run ionic:build --prod 

it looks like it deploy it but my questions are:

  1. what files I need to upload to host for publish the app as PWA?
  2. why when I change something in the app and run ionic serve nothing changed and it changed only in the index.html of the WWW folder? why?(because now it's PWA??)

  3. when I open www folder and I run open index.html when i press on button that open alert dialog it not open that. why?

  4. when I run the command? only in the end of development?
3 Answers

I use this command for building web app

ionic cordova build browser

Then copy the contents from IONIC-PROJECT/platforms/browser/www to the web server.

Related