【问题标题】:Angular Remove service worker for a page url页面网址的 Angular 移除服务工作者
【发布时间】:2021-02-25 12:53:07
【问题描述】:

我有一个注册了服务工作者的 Angular 应用程序。我想删除account/checkout 路由的服务人员。

ngsw-config.json

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": ["/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js"]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": ["/assets/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"]
      }
    }
  ]
}

【问题讨论】:

    标签: angular service-worker


    【解决方案1】:

    你能用下面的代码试试吗,

    {
        "$schema": "./node_modules/@angular/service-worker/config/schema.json",
        "index": "/index.html",
        "assetGroups": [
            {
                "name": "app",
                "installMode": "prefetch",
                "resources": {
                    "files": [
                        "/favicon.ico",
                        "/index.html",
                        "/manifest.webmanifest",
                        "/*.css",
                        "/*.js"
                    ]
                }
            },
            {
                "name": "assets",
                "installMode": "lazy",
                "updateMode": "prefetch",
                "resources": {
                    "files": [
                        "/assets/**",
                        "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
                    ]
                }
            }
        ],
        "navigationUrls": [
            "!/account/checkout"
        ]
    }
    

    更多参考请参考this链接。

    【讨论】:

      猜你喜欢
      • 2016-06-08
      • 2016-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多