title: Angular 6 multiple library cross-dependency
body: <p>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</p>
  
  <p>Here's how it goes:</p>
  
  <p><code>ng generate library lib1</code></p>
  
  <p><code>ng generate library lib2</code></p>
  
  <p>Now in the main application, in <code>package.json</code> I add to <code>tsconfig.json</code> in <code>compilerOptions</code> the libraries (they are automatically inserted)</p>
  
  <p><code>"paths": {
     "lib1": ["../distPack/lib1"],
     "lib2": ["../distPack/lib2"]
  }
  </code></p>
  
  <p>(I modified the path where they are generated to be <code>distPack</code>)</p>
  
  <p>I can import them in <code>app.module</code> and everything works fine</p>
  
  <p><code>import { Lib1Module } from 'lib1'</code></p>
  
  <p><strong>PROBLEM</strong></p>
  
  <p>I want to:
  <code>import { Lib1Module } from 'lib1'</code> in <code>lib2/src/lib/lib2.module.ts</code></p>
  
  <p>And and it can't find it. </p>
  
  <p>What I tried: </p>
  
  <ol>
  <li><code>peerDependency</code></li>
  <li>adding it to <code>tsconfig.lib</code> as <code>paths</code></li>
  <li>including it as direct path (fails in --prod build)</li>
  </ol>
  
  <p><strong>Update</strong></p>
  
  <p>If I build the set the paths  in main <code>tsconfig.json</code> to</p>
  
  <p><code>"paths": {
        "lib1": [
          "dist/lib1"
        ],
  </code></p>
  
  <p>the other libraries can import it without a problem <strong>BUT</strong> it can no longer be imported in <code>app.module</code></p>