title: Angular 9: Value at position X in the NgModule.imports is not a reference
body: <p>I upgraded an Angular App from v8 to v9. The project imports a custom UI library using Angular 8 and moment.js.</p>
  
  <p>When I build it:
  <br></p>
  
  <ol>
  <li><strong>It generates a warning:</strong></li>
  </ol>
  
  <pre><code>WARNING in Entry point '@myLib/catalogue' contains deep imports into
   '/Users/xyz/Projects/forms-frontend/node_modules/moment/locale/de'.
  This is probably not a problem, but may cause the compilation of entry points to be out of order.
  </code></pre>
  
  <p>In the <code>@myLib/catalogue.js</code> file of the library (inside node_modules folder), the moment.js DE locale is imported as following:</p>
  
  <pre><code>import 'moment/locale/de';
  </code></pre>
  
  <p><br></p>
  
  <ol start="2">
  <li><strong>Compilation errors are also triggered:</strong></li>
  </ol>
  
  <pre><code>ERROR in Failed to compile entry-point @myLib/catalogue (es2015 as esm2015) due to compilation errors:
  node_modules/@myLib/catalogue/fesm2015/catalogue.js:213:26 - error NG1010: Value at position 2 in the NgModule.imports of FormInputModule is not a reference: [object Object]
  
  213                 imports: [
                               ~
  214                     CommonModule,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ... 
  219                     TranslateModule
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220                 ],
      ~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <p>The text of the warning seems explaining exactly the compilation error, where the position (2 in this case) is out of range of the imports array.</p>
  
  <p>I have seen different articles/<a href="https://github.com/angular/angular/issues/35615" rel="noreferrer">github issues</a> about deep-links, but no working solution. </p>