I am working on an Ionic Aungular PWA project and I am consistently getting a failed Lighthouse audit in Chrome with a 404 error saying localhost page cant be found for the path I am redirecting to as the default path (/home in this example). I have included my auto generated src/app/app-routing.module.ts file below. If I replace the redirect path to load the “home” module instead of redirecting to the home path, the audit is successful. Can anyone help explain why redirectTo is not working?
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: 'home',
loadChildren: () => import('./pages/home/home.module').then( m => m.HomePageModule)
},
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{
path: 'create-restaurant-menu',
loadChildren: () => import('./pages/page2/page2.module').then( m => m.Page2Model)
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
Ionic Info
Ionic:
Ionic CLI : 6.12.1
Ionic Framework : @ionic/angular 5.3.5
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Utility:
cordova-res (update available: 0.15.2) : 0.15.1
native-run (update available: 1.2.2) : 0.3.0
System:
NodeJS : v12.18.4
npm : 6.14.6
OS : macOS Catalina