task-bug-detail.ts ispart of the declarations of 2 modules: APPModel

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shichuwu/article/details/81869074

           Ionic手机端项目在打包的时候报错 , task-bug-detail.ts ispart of the declarations of 2 modules: AppModule , 出现原因在APPModel中.

APPModel中声明:

task-bug-detail组件自己又声明:

双重声明导致打包运行时报如下错误:

​
ExcellentIntegral_Front>ionic  build --prod
[INFO] Running app-scripts build: --prod

[10:52:17]  build prod started ...
[10:52:17]  clean started ...
[10:52:17]  clean finished in 10 ms
[10:52:17]  copy started ...
[10:52:17]  deeplinks started ...
[10:52:18]  deeplinks finished in 318 ms
[10:52:18]  ngc started ...
[10:52:32]  typescript error
            Type ZentaoPage in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.ts is part of the declarations
            of 2 modules: AppModule in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/app/app.module.ts and ZentaoPageModule in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.module.ts! Please consider
            moving ZentaoPage in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.ts to a higher module that
            imports AppModule in D:/00000 积分第二版/000 08.19Ionic/05_code/ExcellentIntegral_Front/src/app/app.module.ts and
            imports AppModule in D:/00000 积分第二版/000 08.19Ionic/05_code/ExcellentIntegral_Front/src/app/app.module.t
            imports AppModule in D:/00000 积分第二版/000 08.19Ionic/05_code/ExcellentIntegral_Front/src/app/app.module.t            ZentaoPageModule in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.module.ts. You can also create
            a new NgModule that exports and includes ZentaoPage in D:/00000 积分第二版/000            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.ts then import that NgModule in            AppModule in D:/00000 积分第二版/000 08.19Ionic/05_code/ExcellentIntegral_Front/src/app/app.module.ts and
            ZentaoPageModule in D:/00000 积分第二版/000
            08.19Ionic/05_code/ExcellentIntegral_Front/src/pages/community/zentao/zentao.module.ts.

Error: The Angular AoT build failed. See the issues above

​

解决方案 : 把所有组件的Model.ts中的重复声明删除 , 打包运行成功

\ExcellentIntegral_Front>ionic  build --prod
[INFO] Running app-scripts build: --prod

[11:07:47]  build prod started ...
[11:07:47]  clean started ...
[11:07:47]  clean finished in 4 ms
[11:07:47]  copy started ...
[11:07:48]  deeplinks started ...
[11:07:48]  deeplinks finished in 305 ms
[11:07:48]  ngc started ...
[11:08:12]  ngc finished in 24.03 s
[11:08:12]  preprocess started ...
[11:08:12]  preprocess finished in 2 ms
[11:08:12]  webpack started ...
[11:08:13]  copy finished in 25.84 s
[11:09:38]  webpack finished in 85.70 s
[11:09:38]  uglify started ...
[11:09:38]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[11:09:44]  sass finished in 6.55 s
[11:09:44]  cleancss started ...
[11:09:52]  cleancss finished in 7.28 s
[11:10:29]  uglify finished in 51.08 s
[11:10:29]  postprocess started ...
[11:10:29]  postprocess finished in 25 ms
[11:10:29]  lint started ...
[11:10:29]  build prod finished in 161.60 s
[11:10:40]  tslint: ...lentIntegral_Front/src/pages/community/zentao/task-bug-detail/task-bug-detail.ts, line: 2
            'IonicPage' is declared but never used.

       L1:  import { Component,ViewChild } from '@angular/core';
       L2:  import { IonicPage, NavController, NavParams,Content } from 'ionic-angular';
       L3:  import {InterceptorProvider}from '../../../../providers/interceptor/interceptor';

[11:10:40]  lint finished in 11.24 s

猜你喜欢

转载自blog.csdn.net/shichuwu/article/details/81869074
今日推荐