angular - ng build -prod returns error -


i'am using angular cli build , run angluar2 app.

when run: ng server goes fine. when run ng build -prod throws error:

error in unexpected directive 'observablecomponent in /users/projectname/dev02/dashboard-app/src/app/book/observable.component.ts' imported module 'bookcomponent in /users/projectname/dev02/dashboard-app/src/app/book/book.component.ts'. please add @ngmodule annotation.  error in ./src/main.ts module not found: error: can't resolve './$$_gendir/app/app.module.ngfactory' in '/users/projectname/dev02/dashboard-app/src'  @ ./src/main.ts 3:0-74  @ multi ./src/main.ts 

here code observable.component.ts:

import { component, oninit } '@angular/core'; import { observable } 'rxjs'; import { bookservice } '../_service/book.service'; import { book } './book';  @component({    selector: 'app-observable',    templateurl: 'observable.component.html',    styleurls: ['observable.component.css'] })   export class observablecomponent implements oninit {       constructor(private bookservice: bookservice) { }      ngoninit(): void {         this.fetchbooks();     }  } 

and book.component.ts:

import {ngmodule, component, oninit } '@angular/core'; import { observablecomponent } './observable.component'; import { promisecomponent } './promise.component';  @component({     template:  `                 <div class="wrapper-obervable-pormise">                 <div class="wrapper-observable">                     <app-observable></app-observable>                 </div>                 <div class="wrapper-promise">                     <app-promise></app-promise>                 </div>                 </div>              `,     styleurls: ['./book.component.css'] })  @ngmodule({     declarations: [         observablecomponent,         promisecomponent     ],     imports: [         observablecomponent,         promisecomponent     ],     exports: [         observablecomponent,         promisecomponent     ] })  export class bookcomponent {} 

any idea what's going wrong?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -