Deploying app as PWA
Learn how to deploy your app as PWA on a free Firebase hosting
This app's UI isn't designed as a PWA, but you can always make UI changes and deploy it as a PWA as well. Following info is useful just in case you want to change and deploy it as PWA
Prepare Firebase project for PWA
Detailed explanation of Firebase integration in our tutorial here
To deploy the app as PWA , we will demonstrate using Firebase hosting.
First create a project on Firebase.
Now, in your project directory, run
This will install Firebase tools in your project. Now login into Firebase using
It will redirect you to browser, and authenticate using your google account. Once you are logged in, you can run this command to attach the code to your project.
It will take you through a list of options for project setup.
This will create a firebase.json
file which should look like the following
Convert the app into a PWA
The two main requirements of a PWA are a Service Worker and a Web Manifest. While it's possible to add both of these to an app manually, the Angular team has an @angular/pwa
package that can be used to automate this.
To add this package to the app run:
Finally, build your project into production using
This will create a production build of your ionic app for PWA deployment. Use Firebase to deploy the app using
Whenever you make any changes to the app, make sure you run ionic build --prod
before deploying it again on the hosting.
This will deploy your app on a Firebase url such as https://spotifyapp.firebaseapp.com/ where you will see your app running perfectly.
The Firebase console will show the deployment like this
For a more detailed step-by-step guide on PWA deployment, check this blog
When deploying an app through a hosting service, be aware that HTTPS will be required to take full advantage of Service Workers and features like Geolocation etc.
For more information on PWA related option in firebase.json
, check here
Last updated