@nrwl/angular:ng-packagr-lite executor doesn't compile partially compiled libraries
See original GitHub issueCurrent 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β. 2. Errors say that NgxsRootModule is not an NgModule or it is not compiled correctly with ngcc. 3. If you change the executor to @nrwl/angular:package, it compiles correctly.
Nx Report
Node : 16.18.1
OS : darwin x64
npm : 9.1.2
nx : 15.2.1
@nrwl/angular : 15.2.1
@nrwl/cypress : 15.2.1
@nrwl/detox : Not Found
@nrwl/devkit : 15.2.1
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : Not Found
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 15.2.1
@nrwl/js : 15.2.1
@nrwl/linter : 15.2.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/rollup : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 15.2.1
@nrwl/web : Not Found
@nrwl/webpack : 15.2.1
@nrwl/workspace : 15.2.1
typescript : 4.8.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
Failure Logs
> nx run store:build:production
Building Angular Package
------------------------------------------------------------------------------
Building entry point 'store'
------------------------------------------------------------------------------
> NX libs/store/src/lib/store.module.ts:22:12 - error NG6002: 'NgxsRootModule' does not appear to be an NgModule class.
22 imports: [
~
23 NgxsModule.forRoot([TestState]),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 ],
~~~
node_modules/@ngxs/store/src/modules/ngxs-root.module.d.ts:11:22
11 export declare class NgxsRootModule {
~~~~~~~~~~~~~~
This likely means that the library (@ngxs/store) which declares NgxsRootModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
Error: libs/store/src/lib/store.module.ts:22:12 - error NG6002: 'NgxsRootModule' does not appear to be an NgModule class.
22 imports: [
~
23 NgxsModule.forRoot([TestState]),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 ],
~~~
node_modules/@ngxs/store/src/modules/ngxs-root.module.d.ts:11:22
11 export declare class NgxsRootModule {
~~~~~~~~~~~~~~
This likely means that the library (@ngxs/store) which declares NgxsRootModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
at /Users/vtigranyan/projects/wf-fusion/test-ngxs/node_modules/@nrwl/angular/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js:138:19
at Generator.next (<anonymous>)
at fulfilled (/Users/vtigranyan/projects/wf-fusion/test-ngxs/node_modules/@nrwl/angular/node_modules/tslib/tslib.js:115:62)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
> NX Running target "store:build" failed
Failed tasks:
- store:build:production
Hint: run the command with --verbose for more details.
Additional Information
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (3 by maintainers)
@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 runngcc
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.