Is there an way to import an nx-library module in another nx-library module?

Viewed 578

My project is based on nx-workpsace and i am having 1 project in apps and 2 libraries in my libs folder.

The structure looks like this:

+-- apps
|   +-- main-application
+-- libs
|   +-- lib-1 (feature-library)
|   +-- lib-2 (shared-components-library)

I am importing the lib-1 in my main-application like this:

imports: [
  lib1Module.forRoot()
]

If i now try to import the lib1Module in my lib2Module like this

imports: [
  lib1Module
]

Im getting the following error: Uncaught TypeError: Cannot read properties of undefined (reading 'lib1Module')

I think the error is the forRoot() in the main application but i don't know how to fix this, because i need to provide the lib-1 services in the main-application. The reason why i need the lib1Module in my lib2Module is that i use an directive of lib-1 in lib-2.

Info

If I remove the forRoot() it still doesnt work. Is there a way to import an module in an nx-library from another nx-library?

0 Answers
Related