Ionic 3 Angular 4 App在产品发布版本上引发错误

时间:2018-06-27 10:18:39

标签: angular ionic-framework ionic3 ionic-native

我有一个与Angular 4一起使用的Ionic 3应用程序。它运行良好,并且即将发布。当我运行命令ionic cordova build ios --prod --release时,它将引发错误。

Type CompanyPortal in /Users/ustuser/Documents/Proj/src/pages/company-portal/company-portal.ts is part of the declarations of 2 modules: AppModule
            in /Users/ustuser/Documents/Proj/src/app/app.module.ts and CompanyPortalPageModule in
            /Users/ustuser/Documents/Proj/src/pages/company-portal/company-portal.module.ts! Please
            consider moving CompanyPortal in /Users/ustuser/Documents/Proj/pages/company-portal/company-portal.ts to a higher module that imports AppModule in
            /Users/ustuser/Documents/Proj/src/app/app.module.ts and CompanyPortalPageModule in
            /Users/ustuser/Documents/Proj/src/pages/company-portal/company-portal.module.ts. You can
            also create a new NgModule that exports and includes CompanyPortal in /Users/ustuser/Documents/Proj/src/pages/company-portal/company-portal.ts then import that NgModule in AppModule in
            /Users/ustuser/Documents/Proj/src/app/app.module.ts and CompanyPortalPageModule in
            /Users/ustuser/Documents/Proj/src/pages/company-portal/company-portal.module.ts.

通读论坛并显示错误日志,从页面模块中删除模块规范。

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { CompanyPortal } from './company-portal';

@NgModule({
  declarations: [
    //CompanyPortal,
  ],
  imports: [
    //IonicPageModule.forChild(CompanyPortal),
  ],
})
export class CompanyPortalPageModule {

}

完成所有此类操作后,还会发生另一种类型的错误,例如

Can't bind to 'popUpListData' since it isn't a known property of 'cheader'. ("<ion-header class="top-bar">
            <cheader [ERROR ->][popUpListData]="changeDivisonData" [uName]="userName"
            [cheaderValue]="global.headerSelectedValue" (")

popUpListData在我的组件类“ cheader”之一中定义。数据是动态的,在这里像@Input() popUpListData = [];

所有这些在使用常规命令ionic cordova build ios时都有效,但无法运行以进行生产。

请给我建议要克服的想法。

1 个答案:

答案 0 :(得分:0)

考虑到“ ionic cordova build ios --prod --release”命令的问题,请使用以下命令:

ionic cordova build ios --minifycss --optimizejs --minifyjs --release

[注意:-“ ionic cordova build ios --prod --release”命令具有电子邮件模式 表单中的匹配问题,始终给出无效的电子邮件错误,因此未使用 命令]

使用以下链接了解更多详细信息:
https://ionicframework.com/docs/cli/cordova/build/