I have installed multiple libraries in angular 6 and I need to import one library in another. They depend on each other but it's not working
Here's how it goes:
ng generate library lib1
ng generate library lib2
Now in the main application, in package.json I add to tsconfig.json in compilerOptions the libraries (they are automatically inserted)
"paths": {
"lib1": ["../distPack/lib1"],
"lib2": ["../distPack/lib2"]
}
(I modified the path where they are generated to be distPack)
I can import them in app.module and everything works fine
import { Lib1Module } from 'lib1'
PROBLEM
I want to:
import { Lib1Module } from 'lib1' in lib2/src/lib/lib2.module.ts
And and it can't find it.
What I tried:
peerDependency- adding it to
tsconfig.libaspaths - including it as direct path (fails in --prod build)
Update
If I build the set the paths in main tsconfig.json to
"paths": {
"lib1": [
"dist/lib1"
],
the other libraries can import it without a problem BUT it can no longer be imported in app.module