Create PWA for Angular6 Application
Install latest version of Angular CLI using this command:
# npm install -g @angular/cli
OR
# npm install -g @angular/cli@latest
Create a new Angular project using CLI
# ng new Pwa-App
Check Application on Development server
# cd Pwa-App
# ng serve
Using above command, application will run with default view on: http://localhost:4200/
Build your PWA app, with following command:
# ng add @angular/pwa
If you got some versioning issues, please install another pwa version with following command:
# ng add @angular/pwa@0.6.8
This command will do following steps:
1. It will enable the “serviceWorker” flag in “angular.json” file.
2. It will update your “package.json” file and add “@angular/service-worker” to it.
3. It will create “manifest.json” file under your “src” folder
4. It will include “manifest.json” to the “index.html” file.
5. It will create Angular service worker files “.ngsw-worker.js” and “.ngsw.json” in the production build.
6. It will add “ServiceWorkerModule” to “app.module.ts” and register it.
Create the production build using this command:
# ng build –prod
Ready to Solve Your Most Complex Technical Challenges?
Our senior advisors are ready to help you navigate the ever-evolving technology landscape with precision and expertise.
Schedule a ConsultationRelated Articles
Create a project in Angular
Type following command to create a new project: # ng new <PROJECT-NAME> It will ask “Would you like to add Angular routing?…
Install NodeJs and Angular CLI
How to Install NodeJs and Angular CLI Steps for installing NodeJS Open https://nodejs.org/ Download the LTS version and install it. ( *LTS…
Firebase hosting setup for Angular app
1. Firstly install node.js on your machine. # sudo apt-get install nodejs # sudo apt-get install npm 2. To install the firebase…