The two main requirements of a PWA are a and a Web Manifest. While it's possible to add both of these to an app manually, the Angular team has an package that can be used to automate this.
The @angular/pwa
package will automatically add a service worker and a app manifest to the app.To add this package to the app run:
Once this package has been added run ionic build —prod
and the www
directory will be ready to deploy as a PWA.
Deploying
Firebase hosting provides many benefits for Progressive Web Apps, including fast response times thanks to CDN's, HTTPS enabled by default, and support for HTTP2 push.
First, install the Firebase CLI:
The last thing needed is to make sure caching headers are being set correctly. To do this, add the following snippet to the firebase.json
file to the hosting property:
For more information about the properties, see the .
The app can now be deployed by running