From df4e99a4ae7186322eddcab8b6a81a04bd4c2e1a Mon Sep 17 00:00:00 2001 From: 4gray <4gray@users.noreply.github.com> Date: Sun, 18 Sep 2022 21:55:20 +0000 Subject: [PATCH] fix: disable service worker in electron app --- src/app/app.module.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 769a2f530..1139a2af7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -61,12 +61,14 @@ export function DataFactory(dbService: NgxIndexedDBService, http: HttpClient) { deps: [HttpClient], }, }), - ServiceWorkerModule.register('ngsw-worker.js', { - enabled: AppConfig.production, - // Register the ServiceWorker as soon as the app is stable - // or after 30 seconds (whichever comes first). - registrationStrategy: 'registerWhenStable:30000', - }), + !isElectron + ? ServiceWorkerModule.register('ngsw-worker.js', { + enabled: AppConfig.production, + // Register the ServiceWorker as soon as the app is stable + // or after 30 seconds (whichever comes first). + registrationStrategy: 'registerWhenStable:30000', + }) + : [], ], providers: [ {