Ionic 4: Default route now working

The default path in app-routing.module.ts does not seem to be working in my app.
Here is the start of the file:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IsReadyGuard } from './is-ready.guard';
import { LoggedInGuard } from './logged-in.guard';

const routes: Routes = [
  { path: '', redirectTo: '/login', pathMatch: 'full' },
  { path: 'login', canActivate:[IsReadyGuard], loadChildren: './pages/login/login.module#LoginPageModule' },

When I navigate to localhost:8100/login, I see my login page no problem.
If I simply go to localhost:8100, I just get a blank page. (I removed the canActivate guard on /login but no help)

So I tried a patch by adding a condition in app.component.ts after platform.ready()

if (window.location.pathname === "/"){

This works BUT it seems to stack /login as the second page in the navigation stack. The back button (on browser and android) brings me back to a blank page so I’m guessing I’m seeing app.component.ts without a selected path?

Any idea why my default path is not working?
Otherwise, does anyone know what’s the latest and greatest method of managing the navigation stack in Ionic 4? Is there a way I can specify that I want /login to be first (root) in the navigation stack?

Here’s my ionic info:


   ionic (Ionic CLI)             : 4.8.0 (C:\Users\lucch\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.16
   @angular-devkit/build-angular : 0.12.2
   @angular-devkit/schematics    : 7.0.6
   @angular/cli                  : 7.0.6
   @ionic/angular-toolkit        : 1.2.0


   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 5 other plugins)


   NodeJS : v11.4.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

EDIT: I started a new project and the default path does indeed redirect to /home. I started copying files from my project to the new setup and the redirect to login works but my project is huge and if I copy everything, the redirect to login stops working. What could interfere with the default path routing?

Found it! It was one of those evil “silent errors” where it doesn’t work but no errors are displayed.

The problem was that I had shared components. I had created a components.module.ts to share the components in which I was loading the component’s module.ts files (which I had to create manually) since these components also needed to have their own module. (I use ngxTranslate so these components needed to load it in their module to use it). The fact of loading shared component’s modules instead of the components themselves was what was interfering with the default root path.

I know, makes no sense but it’s not the first time I stumble on a “silent error” in Angular. I don’t have a good understanding of NgModules so I’m always a bit lost in there but there it is.