Closed VanTigranyan closed 1 year ago
@leosvelperez Hi. Any input you can provide here? Thanks in advance.
hey @VanTigranyan!
The ng-packagr-lite
executor doesn't run ngcc
on its own when building a library. It relies on you having run ngcc
before building the library. That's correctly stated on the docs, as you can see here https://nx.dev/recipes/other/setup-incremental-builds-angular#requirements.
I'd also recommend reading when to use incremental builds. It's not always a good choice and depends on your application size. Only large applications would benefit from it in a way that outweighs the overhead introduced. If you do need to optimize your application's build time, I recommend you have a look first at using Module Federation for faster builds.
I'm closing this since the executor is working as expected. If you still think there's an issue, please leave a comment and we can revisit it.
Hi, again @leosvelperez. Thanks a lot for the quick response. Actually IMHO there are a couple of issues.
ngcc
in the post-install hook when it is not the case. I generated the repository from scratch with angular preset and post-install contains only decorating ng-cli, not ngcc compilation, so again, one should go over the whole documentation in order to know that this is a requirement. @VanTigranyan that's fair! I can see the issue. We see it natural for folks to discover the ng-packagr-lite
executor (or using buildable libraries) when coming from the docs explaining incremental builds, but we can/should definitely improve the executor docs to include that info. The incremental builds recipe requirements is just outdated, we no longer generate workspaces with a postinstall script to run ngcc
by default because more and more libraries are moving to full Ivy and don't require it. So, it should be added by developers should they need it. I'll amend that as well.
Thanks a lot, @leosvelperez. I appreciate your help and also the consideration of changing docs a bit.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
Hi. So as the title states, when you use a library that is built with the partial compilation mode of Ivy, it doesn't work with ng-packagr-lite. The documentation says nothing about differences between @nrwl/angular:ng-packagr-lite and @nrwl/angular:package (in terms of requirements and compilation process), so the latter works fine and precompiles old libraries while the former one doesn't. Maybe I am not aware of how it should work, but I am stuck right now as I don't need a publishable library inside my monorepo but because of this issue, I have to use @nrwl/angular:package. Please help me understand if I am doing something wrong. I really appreciate any help you can provide.
Expected Behavior
@nrwl/angular:ng-packagr-lite should compile correctly with partially compiled Angular libraries.
Github Repo
https://github.com/VanTigranyan/test-ngxs-nx/tree/master/libs/store
Steps to Reproduce
1.Run "nx build store".
Nx Report
Failure Logs
Additional Information
No response