I have a custom library, which contains some global modules, for example AuthModule. Until I have updated my projects to angular 8, everything worked fine. After I did that, most effects in my custom library don't work. Actions are dispatched, reducers are called, but effects.. Not really. However, one effect is called and it returns another action, which is not dispatched for some reason.
This happens only in production build AND with buildOptimizer set to true. if buildOptimizer is disabled, then everything works as expected. Also, I have created an issue here, because I don't know if it's ngrx bug or angular-cli:
https://github.com/angular/angular-cli/issues/14613
Angular CLI: 8.0.1
Node: 10.7.0
OS: win32 x64
Angular: 8.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router
@ngrx/core: ^1.2.0
@ngrx/effects: ^7.4.0
@ngrx/entity: ^7.4.0
@ngrx/router-store: ^7.4.0
@ngrx/store: ^7.4.0
@angular-devkit/architect 0.800.1
@angular-devkit/build-angular 0.800.1
@angular-devkit/build-ng-packagr 0.800.1
@angular-devkit/build-optimizer 0.800.1
@angular-devkit/build-webpack 0.800.1
@angular-devkit/core 8.0.1
@angular-devkit/schematics 8.0.1
@angular/cli 8.0.1
@angular/flex-layout 8.0.0-beta.26
@ngtools/json-schema 1.1.0
@ngtools/webpack 8.0.1
@schematics/angular 8.0.1
@schematics/update 0.800.1
ng-packagr 5.2.0
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[ X ] No
Hello @DenisSemionov, have you looked at https://github.com/ngrx/platform/issues/1888, is it the same behavior?
Hello @DenisSemionov, have you looked at #1888, is it the same behavior?
Hello, @adrogon, looks very similar, but that author didn't mention buildOptimizer setting, so can't say for sure.
Could you create a small reproduction of this issue?
I couldn't be able to reproduce this issue.
@timdeschryver , I will try to create a repro during this week. I'm not sure yet what causes the problems, ngrx works well as previously, but after I updated my projects to angular 8 effects in my custom library are behaving strangely, they are not triggered.
@timdeschryver , @brandonroberts , I have been able to reproduce it.
Clone this repro project, then build the library ng build disastrous-library, then ng serve angular-ngrx. Try to press the buttons with labels "DO THIS" and "DO THAT" (you will see text with explanation) and see the browser log. Then build ng build angular-ngrx --prod and deploy it. You will see that effects in library stopped working, they are not triggered anymore.
Also, you will notice that user list is loading without any problems, because effects for users are not in library but in main project.
I think this is related to https://github.com/ng-packagr/ng-packagr/issues/1307
Hi all, this issue is caused by the Angular Devkit Build Optimizer.
See here for more context: https://github.com/angular/angular-cli/issues/14613#issuecomment-498960867
I have already landed a fix for this.
This fix has been verified with Angular CLI 8.0.2 and NgRx 8.0.0.
We have experienced the same regression for NgRx 7.4.0 we are using Angular CLI 7.3.9 are there any news what exactly was the regression from Angular DevKit side and if there's any fix for that version of NgRx?
Most helpful comment
Hi all, this issue is caused by the Angular Devkit Build Optimizer.
See here for more context: https://github.com/angular/angular-cli/issues/14613#issuecomment-498960867
I have already landed a fix for this.