-
Notifications
You must be signed in to change notification settings - Fork 12k
Cannot read property 'properties' of undefined when adding a lazy loaded module with ng generate #21397
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
Comments
If the issue is not taken, I would like to give it a try. |
I'm gonna give it a try too. |
@alan-agius4 Ideally, it should skip the file-path without module.ts extension ? |
IMO it should skip the candidate file path without having |
Angular CLI: 12.1.3 Angular: 12.1.3 Package Version@angular-devkit/architect 0.1201.3 |
if this is not resolved yet, then I would like to give it a try |
I would like to try too if is not fixed |
What is the expected fix for this Issue ? Append ".module.ts" after name pass in cli ? |
…ng declaration cannot be found Due to incorrect castings previously the code would crash when the module doesn't contain an routing module with the following error: ``` Cannot read property 'properties' of undefined ``` Closes #21397
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Description
While attempting to find the module to add a lazy loaded route declaration to while generating a new lazy loaded module with option
--module=app
,findModuleFromOptions
tries file candidates from least to most specific:If both app.module.ts and app.ts exist, app.ts is returned. If that file does not include an @angular/core import, this leads to an
Cannot read property 'properties' of undefined
error down the line (node is undefined ingetMetadataField
in ast-utils).🔬 Minimal Reproduction
ng new
.src/app/app.ts
ng g m foo --routing --route=foo --module=app
🔥 Exception or Error
Cannot read property 'properties' of undefined
🌍 Your Environment
Workaround
To work around this issue, we can specify the module by file name, not module name:
ng g m foo --routing --route=foo --module=app.module.ts
The text was updated successfully, but these errors were encountered: