question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@nrwl/angular:ng-packagr-lite executor doesn't compile partially compiled libraries

See original GitHub issue

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”. 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:closed
  • Created 10 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
leosvelperezcommented, Nov 28, 2022

@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.

0reactions
VanTigranyancommented, Dec 6, 2022

Thanks a lot, @leosvelperez. I appreciate your help and also the consideration of changing docs a bit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing libraries into executors that use tsconfig.paths are ...
If you import a library into an executor and that library's import statement uses a tsconfig.path rewrite, the file is not found.
Read more >
Running a compiler in parallel with java.utils.concurrent
I am still a beginner in Java.util.concurrent . In C I just fork or use the POSIX thread library with the join method....
Read more >
10 Things To Know If You Are Not The Executor
To help you and your family, we've compiled a list of things you should know if you're not the executor of an estate....
Read more >
Executor Not Communicating With Beneficiaries | What to Do
What to Do If the Executor Did Not Notify Beneficiaries About the Will. Before an executor can be appointed by the court, they...
Read more >
WHAT IS AN EXECUTOR? - New York City Bar Association
The Executor is responsible for having the Will probated, collecting those assets of the decedent that pass under the Will (i.e., not joint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found