2

I would like to exclude the manifest file from service worker cache, because it is created dynamically by a web function.

<link rel="manifest" href="/.additional/resources/manifest>

I tried to exclude it by adding to dataGroup, assetGroups and navigationUrls as mentioned here:

Angular 5 and Service Worker: How to exclude a particular path from ngsw-config.json

but unfortunately nothing worked and the file is still delivered by ngsw. Please find here the service worker code:

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "dataGroups":
  [
    {
      "name": "performance",
      "urls": ["!/.additional/resources/manifest"],
      "cacheConfig": {
        "maxSize": 0,
        "maxAge": "0u",
        "strategy": "freshness"
      }
    }
  ],
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "!/.additional/resources/manifest",
          "/*.css",
          "/*.js"
        ]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ],
  "navigationUrls": [
    "!/.additional/resources/manifest"
  ]
}

I also already tried to bypass with url parameter and it worker, but I would rather like to exclude from cache:

<link rel="manifest" href="/.additional/resources/manifest?ngsw-bypass=true">

Thank you in advance!

Dennis
  • 61
  • 1
  • 2

0 Answers0