The Angular team has provided a quick command to implement the so-called PWA app.
ng add @angular/pwa --project *your-project-name*
Now, however, the classic ng serve
command does not activate the potential of this type of app.
One way to activate service workers is to use an alternative local web server that simulates a real online web server.
A workaround could be to install a local http server like this:
npm install http-server --dev --save
Add it in scripts in package.json
:
"scripts": {
"start:local": "ng build --prod && http-server -p 4200 -c-1 dist",
...
And run it with:
npm run start:local
Try it at home!