【发布时间】:2019-08-09 12:27:42
【问题描述】:
我在 App Module 中使用了 NgxNotificationComponent。这在 ng 服务中运行良好。但是当我尝试使用 ng build --prod 构建应用程序时,它会引发错误。
ERROR in : Type NgxNotificationComponent in /Development/web-
angular/node_modules/ngx-notification/ngx-notification.d.ts is part of
the declarations of 2 modules: AppModule in /Development/web-
angular/src/app/app.module.ts and NgxNotificationModule in
/Development/web-angular/node_modules/ngx-notification/ngx-
notification.d.ts! Please consider moving NgxNotificationComponent in
/Development/web-angular/node_modules/ngx-notification/ngx-
notification.d.ts to a higher module that imports AppModule in
/Development/web-angular/src/app/app.module.ts and
NgxNotificationModule in /Development/web-angular/node_modules/ngx-
notification/ngx-notification.d.ts. You can also create a new NgModule
that exports and includes NgxNotificationComponent in /Development/web-
angular/node_modules/ngx-notification/ngx-notification.d.ts then import
that NgModule in AppModule in /Development/web-
angular/src/app/app.module.ts and NgxNotificationModule in
/Development/web-angular/node_modules/ngx-notification/ngx-
notification.d.ts
我必须更改节点模块本身还是有任何解决方法。
版本如下
"ngx-notification": "^1.0.5",
开发依赖
"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "~7.1.4",
【问题讨论】:
标签: angular angular7 dev-to-production