title: Angular 6/7 Consuming a custom library throws error TS2397: Cannot find module '*'
body: <p>I'm currently trying to upgrade my Angular 2.something project to the latest version. I had a custom angular.config file so i could build 2 app's consuming the same component 'library'. But then the epic release of Angular 6 arrived with real Angular libraries! But now i am stuck (again) trying to refactor my project to this new version. </p>
  
  <p>I've come as far as building a component library (named 'core') into a DIST folder. Even Typescript is okay with this library. But when i try to build my web-app Angular CLI starts complaining that it can't find the module 'core'. </p>
  
  <p>The following code snippet is the public_api.d.ts in the folder dist/core:</p>
  
  <pre><code>export { WdCoreModule } from './lib/wd-core.module';
  export { wdApi } from './lib/core/wd.service';
  export { ProcessTokenComponent } from './lib/core/process-token.component';
  export { GroupByPipe } from './lib/core/group-by.pipe';
  export { AvatarComponent } from './lib/avatar/avatar.component';
  export { GameElementsModule } from './lib/game-elements/game-elements.module';
  export { AchievementsComponent } from './lib/game-elements/achievements/achievements.component';
  export { ModalComponentComponent } from './lib/modal-component/modal-component.component';
  export { BaseModalService, BaseModalComponent } from './lib/core/basemodal.service';
  export { NavMenuComponent } from './lib/nav-menu/nav-menu.component';
  .... More exports ahead
  </code></pre>
  
  <p>I added the path to this library in my tsconfig.json</p>
  
  <pre><code>"paths": {
        "core": [
          "dist/core"
        ],
        "core/*": [
          "dist/core/*"
        ],
  }
  </code></pre>
  
  <p>Then it's time to import Modules and components from the library 'core' into the app called 'cms'.</p>
  
  <pre><code>import { WdCoreModule } from 'core';
  </code></pre>
  
  <p>No errors yet!
  Now i'm ready to build my project with: <code>ng serve cms</code>
  This will throw the following error:</p>
  
  <p>projects/cms/src/app/app.module.ts(52,30): error TS2307: Cannot find module 'core'.</p>
  
  <p>I've been searching all over for a solution to this problem but i'm kinda stuck. 
  Any coding hero who can help me?</p>
  
  <p><strong>Edit: Extra info for solution</strong></p>
  
  <p>I followed the following post to package and install my build library</p>
  
  <p><a href="https://blog.angularindepth.com/creating-a-library-in-angular-6-part-2-6e2bc1e14121" rel="noreferrer">https://blog.angularindepth.com/creating-a-library-in-angular-6-part-2-6e2bc1e14121</a></p>
  
  <p>The following 2 commands did the trick for me:</p>
  
  <pre><code>//package.json
  "npm_pack": "cd dist/core &amp;&amp; npm pack",
  //then
  npm install dist/core/core-0.0.1.tgz --save
  </code></pre>