fix(compiler-cli): avoid handling functions in loadChildren as lazy load routes paths by Meligy · Pull Request #13676 · angular/angular · GitHub

  • fix(compiler-cli): avoid handling functions in loadChildren as lazy load routes paths #13676
  • Build just succeeds and browser functionality shows no error.
  • It passes the output as the entry argument to RouteDef.fromString(entry: string) , where the error entry.split is not a function happens.
  • clydin reviewed Dec 27, 2016 View changes
  • …oad routes paths The change avoids the compiler CLI internal API from mismatching the following case as lazy loading “` import { NonLazyLoadedModule } from ‘.

Contribute to angular development by creating an account on GitHub.

@Meligy: Having a moment of:
– Making the change, Nothing
– Knowing where to make it, Everything
With this 1st @angularjs PR

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with “x”)

[x] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Build related changes [ ] CI related changes [ ] Other… Please describe:

What is the current behavior? (You can also link to an open issue here)

If you use an official tool that uses the Angular Compiler CLI private API, like Angular CLI (or @ng-tools Webpack plugin), and you have some route code like:

import { NonLazyLoadedModule } from ‘./non-lazy-loaded/non-lazy-loaded.module’; export function getNonLazyLoadedModule() { return NonLazyLoadedModule; } export const routes = [ { path: ‘/some-path’, loadChildren: getNonLazyLoadedModule } ];

using Angular CLI beta.24) shows a build error:

And it also shows in the browser.

What is the new behavior?

No build error in console or browser in that case. Build just succeeds and browser functionality shows no error. Loading modules (lazy or not) works as expected.

Does this PR introduce a breaking change? (check one with “x”)

[ ] Yes [x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: …

Other information:

as a lazy loading string

happens.

@hansl would be an ideal reviewer for this, having created the private API.

Fixes angular/angular-cli#3204

…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

Keep first check to avoid empty strings?

Empty strings are errors. It’s unintentional that they silently did nothing I believe.

Maybe could give a better error message, but that’s a separate improvement I preferred to keep unrelated to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

fix(compiler-cli): avoid handling functions in loadChildren as lazy load routes paths by Meligy · Pull Request #13676 · angular/angular · GitHub

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.