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
Angular2 AOT compilation - "Cannot determine the module for class (... many components which are unused)" #3636
Comments
The error points to a line in
I tried to edit these lines to see if it would be possible to add an
which should just continue, using only components which do have a declared module. However, This simply blows up later down the line, somehow recognizing local code as "external module which cannot be named" |
This is not really an Angular CLI issue, but an Angular one. |
@rolandoldengarm because they don't all belong in the same module. We have an npm module we have created that is essentially a library of generic (with respect to our partner implementations) components, pipes, and directives, to be included as needed. Our base app uses all of them, and thus has no issue with AoT. However, many of our partners require a custom component/pipe/directive in place of the base. Or more common, they DON'T require a large number of our components at all. My understanding of webpack was that if a file is not in the require chain, it is removed from consideration. But if that were the case, it would not blow up at these components (which are entirely unused) lacking a module. If this is really an ngc issue, I will open up an issue with them, but I figured the webpack side of this should be weeding out unused files, so I opened this one here. |
@swimmadude66 ah I see.. Hmm, does it make a difference if you try a production build? |
We only do AoT with the production flag enabled, so that's all I've tried. |
I'm getting the same problem on the lastest cli (beta.22-1). I have a
Adding and removing |
well damn. That means even without the webpack plugin, the ngc is aware of your entire working directory. Would still be nice if the @ngtools/webpack plugin could maybe mask files not in the require chain, since it's already aware of them. I think the best bet in the meantime will be a loader which moves all files in the require chain to a new workspace and runs the compiler there, but that's a REALLY ugly solution.... EDIT: angular/angular ticket: angular/angular#13590 |
angular/angular#13590 seems better to track this, it's not a CLI issue per se. |
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.
Cannot determine the module for class (....)
for each component we don't use.Mention any other details that might be useful.
We have a
src
directory with modules and our app components. However, we use a shared npm module to provide common components, pipes, directives, etc between partner apps. This works fine for JIT, but seems to want a module for every component in the shared npm module too, even if we don't need it for this partner.The text was updated successfully, but these errors were encountered: