How can I eagerly import a subset from a lazy loaded library in an NX workspace?

648 views Asked by At

I am having the following situation for my application. It is an NX workspace with an Angular application and several Angular libraries. E.g.

/apps
  /myapp
  /myapp-e2e
/libs
  /movies
  /books

The movies and books libraries both contain an NgRX (forFeature) store and the corresponding NgModules are loaded lazily via routing in the myapp router configuration. Now I have the situation that I would like to import only the NgRX actions from either of these libraries but the Module itself should remain lazily loaded. The nrwl linting throws that it is not allowed to import from lazy loaded modules

nx-enforce-module-boundaries: imports of lazy-loaded libraries are forbidden

But having an extra shared library just for the store actions seems to be over the roof and I don't want to pollute the libs folder too much. Is it possible to import only a subset of a library and keep the corresponding Angular library module be imported lazily?

0

There are 0 answers