Angular PWA in IIS subfolder not work offline

前端 未结 3 776
灰色年华
灰色年华 2021-01-24 01:57

When I publish angular pwa application to subfolder in IIS, pwa application not work in offline.

ng build --prod --baseHref=/subfolder/ does not help.

I use htt

3条回答
  •  太阳男子
    2021-01-24 02:39

    I know I am very late on this, I have also struggled on this and finally followed these steps to solve the issue:

    1. In manifest.JSON file, set "scope": "." and "start_url": "./". This indicate that you are using sub-directory.

    2. Then build the project using CLI command ng build --prod --baseHref=/Your_sub_directory_name/

    3. And finally paste the dist folder content to your pointed Your_sub_directory_name IIS location.

    4. Then just refresh page and wait to register the service worker, you can check this in application tab of chrome's developer tool. Once service worker is reigstered, just switch to offline mode and you'll the page will work fine in offline.

提交回复
热议问题