@atscott provided a solution, which is shown here in the loadchildren-sans-import-solution
branch.
/**
* We don't have to use `import` with `loadChildren`. Note the
* default export of `RecursiveComponent` is a routes array,
* not the class.
*/
loadChildren: () => import('./recursive.component'),
/**
* We can create a typical `routes` variable and skip the
* `import` statement.
*/
loadChildren: () => routes,
/**
* But this doesn't work due to the error:
* Block-scoped variable 'routes' used before its declaration.ts
*/
children: routes,
This project shows that recursively lazy loading pages DOES NOT work in Angular 17.
After successfully navigating to tabs/tab1/recursive
, attempting to route to tabs/tab1/recursive/recursive
fails with:
ERROR ReferenceError: require_recursive_component is not defined
.
This project was generated with Angular CLI version 17.2.3.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The application will automatically reload if you change any of the source files.