ng xi18n throws exception 'ERROR in Cannot read property 'loadChildren' of undefined' when route data contains an arrow expression
See original GitHub issue🐞 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Running ng xi18n I get this error - Stack Overflow
Running ng xi18n I get this error: "ERROR in Cannot read property 'loadChildren' of null" · Can you show your original routes? ·...
Read more >Angular Interview Questions — You Must Know (2022) - Medium
We have collected over 200+ Angular Interview Questions from various companies around the world. Learn it, remember it and Crack Angular ...
Read more >Rangle.io : Angular 2 Training - Sathyalog
If we try to assign a number to it, we will get an error at compilation time. If you want to have a...
Read more >angular-in-action.pdf
The Dashboard component contains data, which it passes to each of its children using an input binding, which is how Angular shares.
Read more >ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE !!! ------------------- ----- LIKE --- https://codedocu.com/Software/Angular/Angular- Error /Solv...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Verified fixed in 10.1.0-rc.0 using
ng xi18n route-stuff --progress --output-path src/locale --ivy
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.