Skip to content

Commit c4a765b

Browse files
author
Guilherme Andrade Pinto
committed
Workaround to lighthouse valid this app as a pwa. Some problem is heppening when I have lazy modules. I found an open issue that can be the same problem: github.com/angular/angular-cli/issues/9021
1 parent e3c97cc commit c4a765b

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

src/app/app-routing.module.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
33

44

5-
const routes: Routes = [
6-
{
7-
path: 'posts',
8-
loadChildren: () => import('./posts/posts.module').then(mod => mod.PostModule)
9-
},
10-
{
11-
path: '',
12-
redirectTo: 'posts',
13-
pathMatch: 'full'
14-
}
15-
];
5+
const routes: Routes = [];
166

177
@NgModule({
188
imports: [RouterModule.forRoot(routes)],

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { DeviceDetectorModule } from 'ngx-device-detector';
1616
imports: [
1717
BrowserModule,
1818
AppRoutingModule,
19-
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
19+
ServiceWorkerModule.register('./ngsw-worker.js', { enabled: environment.production }),
2020
BrowserAnimationsModule,
2121
SharedModule,
2222
PostModule,

src/app/posts/posts.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import { environment } from '../../environments/environment';
2626
],
2727
imports: [
2828
CommonModule,
29+
ServiceWorkerModule.register('./ngsw-worker.js', { enabled: environment.production }),
2930
PostsRoutingModule,
30-
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production, registrationStrategy: 'registerImmediately' }),
3131
SharedModule
3232
],
3333
})

0 commit comments

Comments
 (0)