-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Including moduleId property in @Component decorator causes 'Module build failed: TypeError: Cannot read property 'getChildAt' of undefined' #4817
Comments
I have the same issue. Nativescript and ng2 together: I need module.id to resolve files path for nativescript, but then the ng2 part crashes with the same error as above. Deps:
|
I can report that the same error occurs and same workaround works with both: @angular/cli: 1.0.0-rc.0 |
I see the same problem but only with
You can try this repo to reproduce - https://github.com/rpoitras/angular-tour-of-heroes |
I'm having some trouble following this issue. This seems related to native script interop? I'm not sure we have a nativescript journey. We don't test for it. Can someone provide me with a simple repo of this problem that only uses a brand new CLI project and native script? |
Apologies @filipesilva. I may have confused this by linking to a non-NativeScript repo. I thought perhaps the issue may have broader scope considering I seen it in a typical Angular CLI test cycle. |
@filipesilva I have the same error only when I run Here is the repo: Currently I have to remove |
@filipesilva, thanks for looking into this. Per your request, I created a repository that demonstrates the issue, built from a brand new Angular CLI project integrated with a brand new NativeScript CLI project using the NativeScript Angular template. |
Heya, can you have a look and see if #5193 fixes it for you? Having
|
Thanks, @filipesilva. Unfortunately, no, assuming the change in question is |
Removing the The problem is just that the |
Oh I think I'm understanding it better... what about this, can you check if it works? Maybe making sure parent is there is all we need.
If this works for you feel free to make a PR. |
Thanks for pursuing this, @filipesilva. While the build succeeds, only if
|
Ok, that's progress. Now it's time to figure out why it's important that Let's try to take the CLI If so, then it might be a problem outside of the CLI. |
Glad to hear we're making progress, @filipesilva. With or without the patch, removing
|
Technically that program should always be the valid one, and is needed in some cases (e.g. diagnostics). Adding parent nodes get rid of the getChildAt error that happens, because the prop.parent is not set. The issue happened because people are using "files": ["main.ts"] or something similar, and when we load another file than main we dont set the parent nodes. Fixes angular#5143 Fixes angular#4817
Technically that program should always be the valid one, and is needed in some cases (e.g. diagnostics). Adding parent nodes get rid of the getChildAt error that happens, because the prop.parent is not set. The issue happened because people are using "files": ["main.ts"] or something similar, and when we load another file than main we dont set the parent nodes. Fixes angular#5143 Fixes angular#4817
Technically that program should always be the valid one, and is needed in some cases (e.g. diagnostics). Adding parent nodes get rid of the getChildAt error that happens, because the prop.parent is not set. The issue happened because people are using "files": ["main.ts"] or something similar, and when we load another file than main we dont set the parent nodes. Fixes angular#5143 Fixes angular#4817
Technically that program should always be the valid one, and is needed in some cases (e.g. diagnostics). Adding parent nodes get rid of the getChildAt error that happens, because the prop.parent is not set. The issue happened because people are using "files": ["main.ts"] or something similar, and when we load another file than main we dont set the parent nodes. Fixes #5143 Fixes #4817
I tried to confirm @hansl's fix, which I see made its way into release |
I was able to add entries to the I am happy to report that |
Happy to say it works for me on the non-NativeScript case as well. Just a bit of refactoring to followup with on a spec file. Thanks to Matt Raible for taking the time to explain - https://github.com/mraible/ng-demo#fix-the-appcomponent-test. Thanks everyone 👍 |
Hey I'm glad to hear that this was the fix that enabled your usecases! |
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. |
OS?
Versions.
Repro steps.
The log given by the failure.
Console.log(moduleIdProp);
in@ngtools\webpack\src\loader.js
at line 257 showsparent
propertyundefined
:Mention any other details that might be useful.
Moving the
moduleId
property to the last position in the@Component
decorator and monkey patching@ngtools\webpack\src\loader.js
as follows allows a successful build.The text was updated successfully, but these errors were encountered: