mariuszfoltak / angular2-datatable

DataTable - Simple table component with sorting and pagination for Angular2
202 stars 182 forks source link

Angular 5 ng build --prod fails #143

Open lawliet616 opened 6 years ago

lawliet616 commented 6 years ago

Angular: 5.0.2 angular2-datatable: 0.6.0

When I run the ng build --prod command I get the following error:

ERROR in ./node_modules/rxjs/_esm5/observable/BoundCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
...
 @ ./node_modules/rxjs/_esm5/observable/bindCallback.js 2:0-68
 @ ./node_modules/rxjs/_esm5/add/observable/bindCallback.js
 @ ./node_modules/rxjs/_esm5/Rx.js
 @ ./node_modules/angular2-datatable/lib/DataTable.js
 @ ./node_modules/angular2-datatable/lib/Paginator.js
 @ ./node_modules/angular2-datatable/lib/DataTableModule.js
 @ ./src/...module.ngfactory.js
 @ ./src/$$_lazy_route_resource lazy
 @ ./node_modules/@angular/core/esm5/core.js
 @ ./src/main.ts
 @ multi ./src/main.ts

The reason is probably that the project has bad rxjs imports, like:

import {Observable} from "rxjs/Rx";
import {map} from 'rxjs/operator/map';

with should be replaced by:

import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';

Could you fix it?

lawliet616 commented 6 years ago

I found the bad line: src/DataTable.ts 6. row

import {ReplaySubject} from "rxjs/Rx";
change that to
import {ReplaySubject} from "rxjs/ReplaySubject";
markschmid commented 6 years ago

@lawliet616 Did it work for you after changing the line? What else did you do to get it to work? It won't work for me. Tried npm rebuild, but to no avail...

lawliet616 commented 6 years ago

@markschmid I forked this project, fixed that line and now I'm using it this way in my package.json:

"angular2-datatable": "github:lawliet616/angular2-datatable"

Try it, it works for me.

markschmid commented 6 years ago

@lawliet616 Thanks! I tried but it won't work (same error). I've found that when I update typescript to 2.5, it works...