title: Angular 10: Unable to write a reference
body: <p>I tried upgrading from angular 8 to 10 following angular update guide.</p>
  <p>My project is consisting of core application, shared (2 libs, google map and shared components)  and one extra apk fsm (2libs, the application and its metadata).</p>
  <p>Build of core and shared are passing but fsm build is failing with &quot;ERROR: Unable to write a reference to ChipComponent in C:/Users/PATH/fsm-frontend/node_modules/shared-frontend/src/components/chip/chip.component.ts from C:/Users/PATH/fsm-frontend/node_modules/shared-frontend/src/components/chip/chip.module.ts
  &quot; error.</p>
  <p>There is not a problem with ChipComponent itself but maybe in some import or tsconfig.</p>
  <p>Shared tsconfig.json:</p>
  <pre><code>{
      &quot;compileOnSave&quot;: false,
      &quot;compilerOptions&quot;: {
          &quot;baseUrl&quot;: &quot;./&quot;,
          &quot;downlevelIteration&quot;: true,
          &quot;importHelpers&quot;: true,
          &quot;outDir&quot;: &quot;./dist/out-tsc&quot;,
          &quot;sourceMap&quot;: true,
          &quot;declaration&quot;: false,
          &quot;module&quot;: &quot;es2020&quot;,
          &quot;moduleResolution&quot;: &quot;node&quot;,
          &quot;emitDecoratorMetadata&quot;: true,
          &quot;experimentalDecorators&quot;: true,
          &quot;target&quot;: &quot;es2015&quot;,
          &quot;typeRoots&quot;: [
              &quot;node_modules/@types&quot;
          ],
          &quot;lib&quot;: [
              &quot;es2017&quot;,
              &quot;dom&quot;
          ],
          &quot;paths&quot;: {
              &quot;shared-frontend&quot;: [
                  &quot;dist/shared-frontend&quot;
              ],
              &quot;shared-frontend/*&quot;: [
                  &quot;dist/shared-frontend/*&quot;
              ],
              &quot;map&quot;: [
                  &quot;dist/map&quot;
              ],
              &quot;map/*&quot;: [
                  &quot;dist/map/*&quot;
              ]
          }
      }
  }
  </code></pre>
  <p>FSM tsconfig.json:</p>
  <pre><code>{
      &quot;compileOnSave&quot;: false,
      &quot;compilerOptions&quot;: {
          &quot;baseUrl&quot;: &quot;./&quot;,
          &quot;importHelpers&quot;: true,
          &quot;outDir&quot;: &quot;./dist/out-tsc&quot;,
          &quot;sourceMap&quot;: true,
          &quot;declaration&quot;: false,
          &quot;module&quot;: &quot;es2020&quot;,
          &quot;moduleResolution&quot;: &quot;node&quot;,
          &quot;emitDecoratorMetadata&quot;: true,
          &quot;experimentalDecorators&quot;: true,
          &quot;target&quot;: &quot;es2015&quot;,
          &quot;typeRoots&quot;: [
              &quot;node_modules/@types&quot;
          ],
          &quot;lib&quot;: [
              &quot;es2017&quot;,
              &quot;dom&quot;
          ],
          &quot;paths&quot;: {
              &quot;fsm-frontend&quot;: [
                  &quot;dist/fsm-frontend&quot;
              ],
              &quot;fsm-frontend/*&quot;: [
                  &quot;dist/fsm-frontend/*&quot;
              ],
              &quot;@angular/*&quot;: [
                  &quot;./node_modules/@angular/*&quot;
              ],
              &quot;rxjs&quot;: [
                  &quot;./node_modules/rxjs&quot;
              ],
              &quot;zone.js&quot;: [
                  &quot;./node_modules/zone.js&quot;
              ],
              &quot;@ngx-translate/*&quot;: [
                  &quot;./node_modules/@ngx-translate/*&quot;
              ],
              &quot;shared-frontend&quot;: [
                  &quot;./node_modules/shared-frontend&quot;
              ],
              &quot;primeng&quot;: [
                  &quot;./node_modules/primeng&quot;
              ],
              &quot;tslib&quot;: [
                  &quot;./node_modules/tslib&quot;
              ],
              &quot;fsm-metadata&quot;: [
                  &quot;dist/fsm-metadata&quot;
              ],
              &quot;fsm-metadata/*&quot;: [
                  &quot;dist/fsm-metadata/*&quot;
              ]
          }
      }
  }
  </code></pre>
  <p>ng-package.json</p>
  <pre><code>{
    &quot;$schema&quot;: &quot;../../node_modules/ng-packagr/ng-package.schema.json&quot;,
    &quot;dest&quot;: &quot;../../dist/shared-frontend&quot;,
    &quot;lib&quot;: {
      &quot;entryFile&quot;: &quot;src/public_api.ts&quot;
    }
  }
  </code></pre>
  <p>shared structure:</p>
  <pre><code>projects - map
                - shared-frontend
                       -src
                             - ...
                             -components
                                         -...
                                         -chip
                                               -chip.component.ts
                                               -chip.module.ts
                                          -index.ts 
  
                        -lib
                           -shared-frontend.module.ts
                         ...
                         pubic_api.ts
  </code></pre>
  <p><strong>shared-frontend.module.ts:</strong></p>
  <pre><code>... // exports including:
  export * from '../components/index';
  @NgModule({
      imports: [CommonModule],
      exports: [
          CommonModule,
  ...
          ChipModule,
  ...
      ]
  })
  export class SharedModule {
      static forRoot(): ModuleWithProviders&lt;SharedModule&gt; {
          return {
              ngModule: SharedModule,
              providers: [
                  SERVICES.....
              ]
          };
      }
  }
  </code></pre>
  <p><strong>index.ts from chip:</strong></p>
  <pre><code>...
  export * from './chip/chip.module';
  export * from './chip/chip.component';
  ...
  </code></pre>
  <p><strong>pubic_api.ts</strong></p>
  <pre><code>export * from './lib/hive-shared-frontend.module';
  </code></pre>
  <p>ng serve also works but apk looks like its not using anything from shared.
  ng build fsm-frontend --prod also passes..</p>
  <p>BTW I am linking both shared(map and frontend) and fsm(frontend and metadata) to core via npm link and shared to fsm via npm link</p>
  <p>EDIT: does order of exports in barrel files matter?</p>