Angular 7-服务工作者FetchEvent错误

时间:2019-07-24 13:41:05

标签: angular service-worker

在生产环境中,有时我的服务工作者会出错。要解决此问题,是否可以禁用service worker进行剩余api调用?我只想为我的静态页面使用Service Worker。我在登录页面/应用程序页面(登录后)上进行了所有其他api调用:

  • www.example.com/login
  • www.example.com/app / **

我不想使用来自api.example.com/**的api调用

这是我得到的错误:

enter image description here

这是我的ngsw-config.json

{
  "index": "/index.html",
  "dataGroups": [
    {
      "name": "connect",
      "urls": ["/connect"],
      "cacheConfig": {
        "maxSize": 0,
        "maxAge": "0u",
        "strategy": "freshness"
      }
    },
    {
      "name": "api",
      "urls": ["/rest/**"],
      "cacheConfig": {
        "maxSize": 0,
        "maxAge": "0u",
        "strategy": "freshness"
      }
    }
  ],
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": ["/favicon.ico", "/index.html", "/*.css", "/*.js"]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": ["/assets/**"]
      }
    }
  ]
}

0 个答案:

没有答案