angular no matching service worker detected

152 Views Asked by At

I have this error despite of an official angular config.

Here is my app.module.ts

        ServiceWorkerModule.register('ngsw-worker.js', {
            enabled: environment.production,
            registrationStrategy: 'registerImmediately'
        }),
    ],
    providers: [
        {
            provide: SwRegistrationOptions,
            useFactory: () => ({enabled: location.search.includes('sw=true')}),
        },
    ],

I have no matching service worker detected in Application Manifest

here is my manifest which works properly

{
  "name": "invoice-app",
  "short_name": "invoice-app",
  "theme_color": "#1976d2",
  "background_color": "#fafafa",
  "display": "standalone",
  "scope": "/invoice-app/",
  "start_url": "/invoice-app/",
  "icons": [
    {
      "src": "assets/icons/icon-72x72.png",
      "sizes": "72x72",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-96x96.png",
      "sizes": "96x96",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-128x128.png",
      "sizes": "128x128",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-144x144.png",
      "sizes": "144x144",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-152x152.png",
      "sizes": "152x152",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-192x192.png",
      "sizes": "192x192",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-384x384.png",
      "sizes": "384x384",
      "type": "image/png",
      "purpose": "maskable any"
    },
    {
      "src": "assets/icons/icon-512x512.png",
      "sizes": "512x512",
      "type": "image/png",
      "purpose": "maskable any"
    }
  ]
}

I cannot figure out why it does not work. I obviously google for it but impossible to find the service worker. Can someone help me please

1

There are 1 best solutions below

0
On

change the manifest.webmanifest extension to manifest.json. It will do the work.