脱机时服务工作人员无法加载字体

时间:2019-03-21 15:01:12

标签: angular service-worker browser-cache progressive-web-apps angular-service-worker

我正在将服务人员添加到现有的Angular Web应用中。

ngsw-config.json中,我包括了:

"assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/*.css",
          "/*.js"
        ]
      }
    }, {
      "name": "assets",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**"
        ]
      }
    }

字体文件在assets/fonts/*中可用,因此它应该包含在表达式/assets/**

在我的应用程序中切换到离线模式时。每个资产均按预期方式从缓存加载。但是我在控制台中仅对我的字体有此错误:

The FetchEvent for "http://localhost:8001/assets/fonts/pluto-regular.otf" resulted in a network error response: the promise was rejected.

GET http://localhost:8001/assets/fonts/pluto-regular.otf net::ERR_FAILED

我手动检查了缓存,就在这里...

enter image description here

如何进一步调试?发生了什么事?

0 个答案:

没有答案