I want to start a new project and would like to
- Use Ionic v4 beta
- Capacitor
- PWA first
(4. Later: mobile support)
I am a bit lost in documentation as of how to start this setup.
What I did now:
- Create Ionic project v4:
- ionic start Appname blank
- Say yes to use v4
- Add capacitor:
- npm install --save @capacitor/core @capacitor/cli
- npx cap init
- npm run build
- Add ng PWA as found in some ionic doc (https://beta.ionicframework.com/docs/publishing/progressive-web-app/)
- ng add @angular/pwa
- ionic build --prod
Was that right? Trying to use “ionic serve” it doesn’t seem to work. According chromes dev tools no service worker is found.
edit: OK i found the missing piece in https://angular.io/guide/service-worker-getting-started, which mentiones ng serves does not work with service workers and suggests a different http server to be used.
I just found another doc regarding ionic PWA toolkit (https://ionicframework.com/pwa/toolkit) which tells a different way starting the whole project directly with this toolkit, which seems to have some prepared stuff?
Is there any advantage to one or the other way?
Additional question:
When I need some custom code in a service worker - where to add it? the service workers are generated directly in /www/ dir which will be overriden by next build, right?