Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng xi18n throws exception 'ERROR in Cannot read property 'loadChildren' of undefined' when route data contains an arrow expression #37776

Open
rsivan opened this issue Jun 26, 2020 · 0 comments
Labels
Milestone

Comments

@rsivan
Copy link

@rsivan rsivan commented Jun 26, 2020

🐞 bug report

Is this a regression?

Reported on 10.0.0.
This also happens in 9.x

Description

ng xi18n reports the following:
ERROR in Cannot read property 'loadChildren' of undefined

🔬 Minimal Reproduction

https://github.com/rsivan/route-error

🔥 Exception or Error




> ng xi18n route-stuff --progress --output-path src/locale

ERROR in Cannot read property 'loadChildren' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! route-stuff@0.0.0 xi18n: `ng xi18n route-stuff --progress --output-path src/locale`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the route-stuff@0.0.0 xi18n script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

🌍 Your Environment

Angular Version:




Angular CLI: 10.0.0
Node: 13.12.0
OS: darwin x64

Angular: 10.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.0
@angular-devkit/build-angular     0.1000.0
@angular-devkit/build-optimizer   0.1000.0
@angular-devkit/build-webpack     0.1000.0
@angular-devkit/core              10.0.0
@angular-devkit/schematics        10.0.0
@ngtools/webpack                  10.0.0
@schematics/angular               10.0.0
@schematics/update                0.1000.0
rxjs                              6.5.5
typescript                        3.9.5
webpack                           4.43.0

Anything else relevant?

The root cause appears to be using an arrow expression in a route definition.
Note that the application compiles and runs correctly, just xi18n fails.

{ path: 'view1', component: View1Component, data: { permission: (r: any) => r.guide > 0 }},

removing the arrow expression fixes the issue.

@ngbot ngbot bot added this to the needsTriage milestone Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.