How to run service worker locally with Angular

前端 未结 4 1271
小蘑菇
小蘑菇 2021-01-12 15:16

I am following angular\'s best practice in order to make PWA. After making production build (ng build --prod --aot), I am also running the service worker from

4条回答
  •  囚心锁ツ
    2021-01-12 15:33

    You can't serve your Angular project with service worker via ng serve, as the documentation for Service Workers state that it requires https. The only way to run it without https/on a server, is to use ng build and run the http-server locally to test your project.

    Because ng serve does not work with service workers, you must use a separate HTTP server to test your project locally.

提交回复
热议问题