是关于离子的2个模块的声明的一部分

时间:2018-09-03 22:56:26

标签: typescript ionic3

当我运行ionic cordova build android --release --prod命令时,在控制台中会产生以下错误消息

有人可以给我一种我应该如何进行的方法吗?因为我正在等待发布我的应用程序

 `Type LoginPage in c:/Users/Mike/Desktop/GuiaCorretor/src/pages/login/login.ts is part of the declarations of
  2 modules: AppModule in c:/Users/Mike/Desktop/GuiaCorretor/src/app/app.module.ts and LoginPageModule`

这是我的app.module.ts

import { LoginPage } from './../pages/login/login';
import { SobrePage } from '../pages/sobre/sobre';
import { PrediosPage } from "../pages/predios/predios";
import { NovidadesPage } from '../pages/novidades/novidades';
import { SocialPage } from '../pages/social/social';

@NgModule({
  declarations: [
    MyApp,
    LoginPage,
    SobrePage,
    PrediosPage,
    NovidadesPage,
    SocialPage,

  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    AngularFireModule.initializeApp(FIREBASE_CONFIG),
    AngularFireAuthModule,
    IonicStorageModule.forRoot()

  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    LoginPage,
    SobrePage,
    PrediosPage,
    NovidadesPage,
    SocialPage,

  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

这是我的login.module.ts 我有提到进口吗?在我的login.module.ts

`import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { LoginPage } from './login';

@NgModule({
  declarations: [
    LoginPage,
  ],
  imports: [
    IonicPageModule.forChild(LoginPage),
  ],
})
export class LoginPageModule {}
`

![As a complement I leave this image to show the following error that appears in my terminal ] 1

1 个答案:

答案 0 :(得分:1)

您要做的是从AppModule中删除LoginPage的声明,然后将LoginModule导入到AppModule中。您只能在一个模块中声明LoginPage。