Ionic 4 - PWA -> offline not working

Hi all,

I have created a PWA that works fine, it is served on an IIS server in a sub/subfolder, all is working fine except it is not working when offline. When I look into the file “www/ngsw.json” it looks like this:

{
  "configVersion": 1,
  "timestamp": 1554818718950,
  "appData": {
    "version": "0.0.6"
  },
  "index": "/subfolder/www/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "updateMode": "prefetch",
      "urls": [],
      "patterns": []
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "urls": [],
      "patterns": [
        "https:\\/\\/fonts\\.googleapis\\.com\\/.*"
      ]
    }
  ],
  "dataGroups": [],
  "hashTable": {},
  "navigationUrls": [
    {
      "positive": true,
      "regex": "^\\/.*$"
    },
    {
      "positive": false,
      "regex": "^\\/(?:.+\\/)?[^/]*\\.[^/]*$"
    },
    {
      "positive": false,
      "regex": "^\\/(?:.+\\/)?[^/]*__[^/]*$"
    },
    {
      "positive": false,
      "regex": "^\\/(?:.+\\/)?[^/]*__[^/]*\\/.*$"
    }
  ]
}

Shouldn’t the

“name”: “app”
“urls”: [ ]

have any references ? Like they are set in the file ngsw-config.json ?
For example:

  ...
     "name": "app",
       ...
        "files": [
          "/favicon.ico",
          "/index.html",
          "/*.css",
          "/*.js"
        ]
     ...

I used the “ionic build --prod” command.

Or is something else wrong ?

Ionic CLI 4.12.0
Angular: ^7.2.2

Forgot to answer this, it is working fine now, it was a small typo in the web.config file on the server that caused this issue.

What was the typo and where do i find web.config in ionic4 project ?

The typo caused the web.config file to not readed as an xml.

The web.config file is on the server (IIS), not in Ionic, if it is not present on the server, you have to create it yourself.