fix(compiler-cli): avoid handling functions in loadChildren as lazy load routes paths
The change avoids the compiler CLI internal API from mismatching the following case as lazy loading ``` import { NonLazyLoadedModule } from './non-lazy-loaded/non-lazy-loaded.module'; export function getNonLazyLoadedModule() { return NonLazyLoadedModule; } export const routes = [ { path: '/some-path', loadChildren: getNonLazyLoadedModule } ]; ``` The output of the check is later passed to `RouteDef.fromString()`, so, it makes sense to be only a string. Fixes angular/angular-cli#3204
This commit is contained in:
parent
2e3ac70e0a
commit
aeed7373af
|
@ -198,7 +198,7 @@ function _collectRoutes(
|
||||||
*/
|
*/
|
||||||
function _collectLoadChildren(routes: Route[]): string[] {
|
function _collectLoadChildren(routes: Route[]): string[] {
|
||||||
return routes.reduce((m, r) => {
|
return routes.reduce((m, r) => {
|
||||||
if (r.loadChildren) {
|
if (r.loadChildren && typeof r.loadChildren === 'string') {
|
||||||
return m.concat(r.loadChildren);
|
return m.concat(r.loadChildren);
|
||||||
} else if (Array.isArray(r)) {
|
} else if (Array.isArray(r)) {
|
||||||
return m.concat(_collectLoadChildren(r));
|
return m.concat(_collectLoadChildren(r));
|
||||||
|
|
Loading…
Reference in New Issue