title: Angular can't find module when build (prod only)
body: <p>I'm building a angular module using angular cli. And in another project I'm calling this module.</p>
  
  <p>When I run <code>ng serve</code>, It all works. But when I run <code>ng build --prod</code> I get the following error:</p>
  
  <blockquote>
    <p>ERROR in
    ./node_modules/my-module/dist/pagination/pagination.ngfactory.js
    Module not found: Error: Can't resolve 'pagination' in
    '/my-web-application/node_modules/my-module/dist/pagination'</p>
    
    <p>ERROR in ./src/app/app.module.ngfactory.js Module not found: Error:
    Can't resolve 'pagination' in '/my-web-application/src/app'</p>
    
    <p>ERROR in ./src/app/areas/private/users/list/index.ngfactory.js Module
    not found: Error: Can't resolve 'pagination' in
    '/my-web-application/src/app/areas/private/users/list'</p>
  </blockquote>
  
  <p>In my web application, I'm loading my module this way</p>
  
  <pre><code>@NgModule({
    ...
    imports: [
      MyModule
    ],
    ...
    bootstrap: [AppRootComponent]
  })
  export class AppModule { }
  </code></pre>
  
  <p>And calling the component module this way</p>
  
  <pre><code>&lt;pagination [data]="pagination"&gt;&lt;/pagination&gt;
  </code></pre>
  
  <p>In MyModule, this is how it's configured</p>
  
  <pre><code>@NgModule({
    declarations: [PaginationComponent],
    imports: [
      CommonModule,
    ],
    exports: [PaginationComponent]
  })
  export class MyModule { }
  </code></pre>
  
  <p>What could I be doing that make it crash only when <code>ng build --prod</code>?</p>
  
  <pre><code>Angular CLI: 8.3.5
  Node: 10.15.0
  OS: darwin x64
  Angular: 8.2.7
  ... animations, common, compiler, compiler-cli, core, forms
  ... language-service, platform-browser, platform-browser-dynamic
  ... router
  
  Package                           Version
  -----------------------------------------------------------
  @angular-devkit/architect         0.803.5
  @angular-devkit/build-angular     0.803.5
  @angular-devkit/build-optimizer   0.803.5
  @angular-devkit/build-webpack     0.803.5
  @angular-devkit/core              8.3.5
  @angular-devkit/schematics        8.3.5
  @angular/cdk                      8.2.0
  @angular/cli                      8.3.5
  @angular/flex-layout              8.0.0-beta.27
  @angular/material                 8.2.0
  @ngtools/webpack                  8.3.5
  @schematics/angular               8.3.5
  @schematics/update                0.803.5
  rxjs                              6.4.0
  typescript                        3.5.3
  webpack                           4.39.2
  </code></pre>
  
  <p><a href="https://github.com/angular/angular-cli/issues/15645" rel="nofollow noreferrer">https://github.com/angular/angular-cli/issues/15645</a></p>