This is my working router in the dev environment.
const WEBAPP_ROUTES: Routes = [
{ path: 'feed', component: LiveFeedComponent},
{ path: 'register-line', component: RegisterLineComponent},
{ path: 'rides', component: RidesComponent},
{ path: 'track', component: TrackPageComponent},
{ path: 'settings', component: SettingsComponent},
{ path: 'user', redirectTo: 'user/'+localStorage.getItem('username'), pathMatch: 'full'},
{ path: 'user/:id', component: ProfileComponent}
];
However it break after AoT build, and gives this output, when trying to access the web app.
Uncaught Error: Invalid configuration of route 'user'. One of the following must be provided: component, redirectTo, children or loadChildren
I've tried defining the routes in childs like this: (which also worked with the dev enviroment).
const WEBAPP_ROUTES: Routes = [
// { path: '**', redirectTo: 'feed', pathMatch: 'full'},
{ path: 'feed', component: LiveFeedComponent},
{ path: 'register-line', component: RegisterLineComponent},
{ path: 'rides', component: RidesComponent},
{ path: 'track', component: TrackPageComponent},
{ path: 'settings', component: SettingsComponent},
{ path: 'user', children: [
{ path: '', redirectTo: localStorage.getItem('username'), pathMatch: 'full' },
{ path: ':id', component: ProfileComponent }
]}
];
How come the error messages doesn't even make sense?
EDIT: Related github discussion: link