NgxNotification 组件在生产构建中失败。 Angular 7

NgxNotification Component fails in production build. Angular 7

我在应用模块中使用了 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",

在您 app.module.ts 中导入不是 NgxNotificationComponent 到声明,而是 NgxNotificationModule 到导入。文档不太正确。
它在生产中有效:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgxNotificationModule} from 'ngx-notification';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxNotificationModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }