Skip to content

Commit

Permalink
fix(compiler-cli): avoid handling functions in loadChildren as lazy l…
Browse files Browse the repository at this point in the history
…oad 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
  • Loading branch information
Meligy committed Dec 31, 2016
1 parent bb0d23f commit 93af424
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/@angular/compiler-cli/src/ngtools_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function _collectRoutes(
*/
function _collectLoadChildren(routes: Route[]): string[] {
return routes.reduce((m, r) => {
if (r.loadChildren) {
if (r.loadChildren && typeof r.loadChildren === 'string') {
return m.concat(r.loadChildren);
} else if (Array.isArray(r)) {
return m.concat(_collectLoadChildren(r));
Expand Down

0 comments on commit 93af424

Please sign in to comment.