I have created freshly a PWA with Angular CLI using the following versions:
Angular CLI: 1.6.8
Node: 8.8.1
Angular: 5.2.5
My problem: When I go offline I just get a blank page. The service worker does not load any assets from the cache. If I manually stop and start it then it will start to work for a short time.
Haven't changed anything this is what the cli generated.
Configuration I am using:
ngsw.json:
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [ "/favicon.ico", "/index.html" ],
"versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": { "files": [ "/assets/**" ] }
}]
}
and app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ServiceWorkerModule } from '@angular/service-worker';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Any suggestion where I could start to look for a solution?