I'm using angular 5. The app runs with ng build
and ng serve
. However it fails with --prod flag for both. Following is the error:
ERROR in Error: Invalid provider for the NgModule 'ɵd in /Users/me/project/node_modules/@ngrx/effects/effects.d.ts' - only instances of Provider and Type are allowed, got: [?null?]
Can someone give some hints?
It's ridiculous. This problem is because ng-cli doesn't work well with default import in ES6.
In my component.module.ts, I included component.effects.ts as below.
import {EffectsModule} from '@ngrx/effects';
import MyEffects from '@app/component/state/component.effects';
@NgModule({
imports: [
...
EffectsModule.forFeature([ MyEffects ])
],
...
})
export class QueryModule {}
The error is import MyEffects from
. I changed it to import {MyEffects} from
and in my component.effects.ts, I replaced default import with named import.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With