Clone https://github.com/l3ender/ngrx-aot. Running app without AOT works (npm run start). Running with AOT (npm run start:prod) causes bootstrap to fail. It appears that items (action and service) are not injected into the Effect.
Firefox error:
TypeError: this.actions$ is undefined
Chrome error:
Uncaught TypeError: Cannot read property 'pipe' of undefined
App behavior would be the same with or without AOT.
"@angular/core": "^7.1.3",
"@ngrx/effects": "^7.0.0",
"@ngrx/store": "^7.0.0",
Using same version of Angular CLI (7.1.3).
$ ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ â–³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.1.4
Node: 10.13.0
OS: win32 x64
Angular: 7.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.11.4
@angular-devkit/build-angular 0.11.4
@angular-devkit/build-ng-packagr 0.11.4
@angular-devkit/build-optimizer 0.11.4
@angular-devkit/build-webpack 0.11.4
@angular-devkit/core 7.1.4
@angular-devkit/schematics 7.1.4
@ngtools/json-schema 1.1.0
@ngtools/webpack 7.1.4
@schematics/angular 7.1.4
@schematics/update 0.11.4
ng-packagr 4.4.5
rxjs 6.3.3
typescript 3.1.6
webpack 4.23.1
I'm not sure where I'd begin.
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[ x ] No
The problem was caused by a barrel import, https://github.com/l3ender/ngrx-aot/pull/1 contains a fix.
This problem occurs in my project.
I tried updating project to angular 8 and ngrx to 8 but it didn't help, it is the same, actions are not injected in service
Any advice?
@aleksandar-petrovic Having the same problem here, did you manage to get it working?
Yes I did.
I had index.ts which was exporting Effects from effects.ts file. And then used that export as import in Effects.forFeature
After changing to direct import without index.ts it worked.
@aleksandar-petrovic Thanks! That fixed it for me.
Most helpful comment
Yes I did.
I had index.ts which was exporting Effects from effects.ts file. And then used that export as import in Effects.forFeature
After changing to direct import without index.ts it worked.