Ionic 3 publishes application as PWA (Progressive Web App)

I want to publish my application as PWA, so what I did

paste this script in 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 he is deploying it, but my questions are:

  • What files do I need to upload to the hosting to publish the application as a PWA?
  • why, when I change something in the application and start the ionic service, nothing changes, and it changes only in the index.html of the WWW folder? why? (because now it's PWA ??)

  • when I open the www folder and run open index.html when I click the button to open a warning dialog about opening. why?

  • when do i run the command? only at the end of development?
+7
4

Run

ionic cordova platform add browser

ionic build browser --prod --release

[project_folder]/platforms/browser/www http-.

+14

PWA. npm run build --prod /www.

PWA , "on" "off". , , , , "", , , .. , , PWA, "" ( , , ). , HTTPS .

index.html, cordova.js( 404, /www).

+9

-

ionic cordova build browser

IONIC-PROJECT/platform/browser/www -.

0

Ionic pwa https://github.com/enaizi/pwa-sidemenu. Google Workbox.

0

All Articles