title: Component is part of the declaration of 2 modules
body: <p>I try to build an ionic 2 app.
  When I try the app in the browser with ionic serve or launch it on an emulator everything works fine.</p>
  <p>But when I try to build it every time the error</p>
  <pre><code>ionic-app-script tast: &quot;build&quot;
  Error Type AddEvent in &quot;PATH&quot;/add.event.ts is part of the declarations of 2 modules: AppModule in &quot;PATH&quot;/app.modules.ts and AddEvent in &quot;PATH&quot;/add-event.module.ts.
  Please consider moving AddEvent in &quot;PATH&quot;/add-event.ts to a higher module that imports AppModule in &quot;PATH&quot;/app.module.ts and AddEventModule.
  You can also create a new NgModule that exports and includes AddEvent then import that NgModule in AppModule and AddEventModule
  </code></pre>
  <p>my AppModule is</p>
  <pre class="lang-ts prettyprint-override"><code>import { NgModule, ErrorHandler } from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
  import { AngularFireModule } from 'angularfire2';
  import { MyApp } from './app.component';
  import { Eventdata } from '../providers/eventdata';
  import { AuthProvider } from '../providers/auth-provider';
  import { HttpModule } from '@angular/http';
  
  import { HomePage } from '../pages/home/home';
  import { Login } from '../pages/login/login';
  import { Register } from '../pages/register/register';
  import { AddEvent } from '../pages/add-event/add-event';
  import { EventDetails } from '../pages/event-details/event-details';
  
  import { StatusBar } from '@ionic-native/status-bar';
  import { SplashScreen } from '@ionic-native/splash-screen';
     
  
  @NgModule({
    declarations: [
      MyApp,
      HomePage,
      Login,
      Register,
      AddEvent,
      EventDetails
      
    ],
    imports: [
      BrowserModule,
      IonicModule.forRoot(MyApp),
      HttpModule,
      AngularFireModule.initializeApp(config)
    ],
    bootstrap: [IonicApp],
    entryComponents: [
      MyApp,
      HomePage,
      Login,
      Register,
      AddEvent,
      EventDetails
    ],
    providers: [
      StatusBar,
      SplashScreen,
      {provide: ErrorHandler, useClass: IonicErrorHandler}, Eventdata, AuthProvider
    ]
  })
  export class AppModule {}
  </code></pre>
  <p>and my add-event.module.ts is</p>
  <pre class="lang-ts prettyprint-override"><code>import { NgModule } from '@angular/core';
  import { IonicPageModule } from 'ionic-angular';
  import { AddEvent } from './add-event';
  
  @NgModule({
    declarations: [
      AddEvent,
    ],
    imports: [
      IonicPageModule.forChild(AddEvent),
    ],
    exports: [
      AddEvent
    ]
  })
  export class AddEventModule {}
  </code></pre>
  <p>I understand that I have to remove one of the declarations, but I don't know how.</p>
  <p>If I remove the declaration from AppModule I get an Error that the Login Page is not found, while running ionic serve</p>