title: Ionic 3: no component factory found,did you add it to @NgModule.entryComponents?
body: <p>I've created an Angular library which has a few components and one module to export all. The module of this library is as follows:</p>
  
  <pre><code>import { NgModule, ModuleWithProviders } from '@angular/core';
  import { FirstComponent } from './first';
  import { IonicModule } from 'ionic-angular';
  import { ProviderTest } from '../../providers/test/test'
  import { SecondComponent } from '../second/second';
  import { ThirdComponent } from '../third/third';
  
  @NgModule({
      imports: [
          IonicModule
      ],
      declarations: [
          FirstComponent,
          SecondComponent,
          ThirdComponent
      ],
      exports: [
          FirstComponent,
          SecondComponent,
          ThirdComponent
      ],
      entryComponents: [
          FirstComponent,
          SecondComponent,
          ThirdComponent
      ]
  })
  export class ComponentModule {
      static forRoot(): ModuleWithProviders {
          return {
              ngModule: ComponentModule,
              providers: [ProviderTest]
          };
      }
  }
  </code></pre>
  
  <p>My problem comes that when I try to use this library in my project, I get this:</p>
  
  <pre><code>Error: Uncaught (in promise): Error: No component factory found for SecondComponent. Did you add it to @NgModule.entryComponents?
  </code></pre>
  
  <p>I've seen related questions where they say to add my <code>ComponentModule</code> to the declarations of the module where I want to use this library, but if I do that, I get this error:</p>
  
  <pre><code>Error: Uncaught (in promise): Error: Unexpected module 'ComponentModule' declared by the module 'TestPageModule'. Please add a @Pipe/@Directive/@Component annotation.
  </code></pre>
  
  <p>The module of my <code>TestPageModule</code> is like this right now:</p>
  
  <pre><code>@NgModule({
    declarations: [
      TestPage,
      ComponentModule
    ],
    imports: [
      IonicPageModule.forChild(TestPage),
      ComponentModule
    ],
  })
  export class TestPageModule {}
  </code></pre>
  
  <p>Does anyone know what the problem is? <code>SecondComponent</code> is a modal, just incase it's of any use. Also, this only happens when using lazy loading.</p>
  
  <p>Thanks.</p>