简体   繁体   中英

angular build --prod error

Type src/app/createreportcomponent component.ts is part of the declarations of 2 modules Error but the normal development build is working fine. How to fix the Error

****App Module ts file****

import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { AngularDualListBoxModule } from 'angular-dual-listbox';

import { HomeComponent } from './home/home.component';
import { CreatereportComponent } from './createreport/createreport.component';
import { AppRoutingModule } from './app-routing.module';

import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { HttpModule } from '@angular/http';

import { Angular2CsvModule } from 'angular2-csv';

// import {ToastModule} from 'ng2-toastr/ng2-toastr';

import { CommonService } from './services/common.service';

@NgModule({
  declarations: [
    AppComponent,
    HomeComponent,
    CreatereportComponent
  ],
  imports: [
     BrowserModule,
     AngularDualListBoxModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    HttpModule,
    FormsModule,
    Angular2CsvModule,
   // ToastModule.forRoot(),
  ],
  providers: [{provide: LocationStrategy, useClass: HashLocationStrategy},CommonService],
  bootstrap: [AppComponent]
})
export class AppModule { }

Create Component ts file

如果在另一个模块中使用“ createreportcomponent”,则将其从主模块中删除。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM