-
Notifications
You must be signed in to change notification settings - Fork 12k
ng build/serve --target=production fails to load components from CoreModule #5245
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
We'll need some additional information. Can you please provide your AppModule and CoreModule definitions? |
@clydin here's that core.module.ts and app.module.ts. |
@ukaaa yes you for sure want to use AOT in production. Can you try commenting out one module at a time and see which eactly is giving you the error? Also I did notice that in your core module you have CanDeactivateComponent in your providers Array. |
@deebloo |
cool cool. just figured id check :) |
@ukaaa Do you use |
@ukaaa I found you have array concatenate in here |
@changLiuUNSW oh no, it was the concatenation all along! But how come it works with the |
The production build is different with dev build. |
Yes it solves the problem. How strange, an Array concatenation returns a new array, so I don't see how it could have such a big impact. Anyway, it's great that it works now! |
AOT mode statically analyzes the Modules, Components, etc. at build time. As a result, the array manipulation will not be executed. |
Thanks for clarifying @clydin. I had no idea. |
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. |
Possibly related to #5098
OS
Windows 10
Versions
Repro steps
CoreModule
has a couple of components in the declarations array and in the exports array.CoreModule
is imported intoAppModule
.The log given by the failure
The build fails. All components declared in
CoreModule
cannot be found:Finally it says
Other details that might be useful.
The build errors only occur when when the
--target
flag is set to production or when I callng serve --prod
.The text was updated successfully, but these errors were encountered: