fix(compiler-cli): don't throw when listing lazy routes for an entry route (#28372)

In https://github.com/angular/angular/pull/27697 the listLazyRoutes was fixed to work with ivy.

Since the entryRoute argument is not supported, it was made to also error.

But by erroring it breaks existing usage with Angular CLI where the entry route is sent in as an argument.

This commit changes listLazyRoutes to not error out, but instead ignore the argument.

PR Close #28372
This commit is contained in:
Filipe Silva 2019-01-29 11:47:01 +00:00 committed by Miško Hevery
parent 71fa1f2a45
commit 2caa419990
1 changed files with 2 additions and 4 deletions

View File

@ -191,11 +191,9 @@ export class NgtscProgram implements api.Program {
} }
listLazyRoutes(entryRoute?: string|undefined): api.LazyRoute[] { listLazyRoutes(entryRoute?: string|undefined): api.LazyRoute[] {
if (entryRoute !== undefined) {
throw new Error(
`Listing specific routes is unsupported for now (got query for ${entryRoute})`);
}
this.ensureAnalyzed(); this.ensureAnalyzed();
// Listing specific routes is unsupported for now, so we erroneously return
// all lazy routes instead (which should be okay for the CLI's usage).
return this.routeAnalyzer !.listLazyRoutes(); return this.routeAnalyzer !.listLazyRoutes();
} }