angular-redux / store

Angular 2+ bindings for Redux
MIT License
1.34k stars 205 forks source link

Importing NgReduxModule includes full RxJS bundle #537

Open danielcrisp opened 5 years ago

danielcrisp commented 5 years ago

This is a...

What toolchain are you using for transpilation/bundling?

Environment

NodeJS Version: 8.11.3 Typescript Version: 2.7.2 Angular Version: 6.1.1 @angular-redux/store version: 9.0.0 @angular/cli version: 6.1.2 OS: macOS 10.13.6

Expected Behaviour:

RxJS's pipeable operators should allow the build process to eliminate dead code, meaning that only the utilised operators are included in the final bundle.

Actual Behaviour:

Importing NgReduxModule results in all RxJS operators being included in the final bundle.

Without NgReduxModule (35.96 KB)

screenshot at aug 06 10-45-59

With NgReduxModule (141.77 KB)

screenshot at aug 06 10-46-15

Additional Notes:

I think this is happening because the tsconfig.build.json file is using the module setting of commonjs rather than es2015.

https://github.com/angular-redux/store/blob/master/tsconfig.build.json#L5

Changing this setting, rebuilding the store package, then re-running my app's build results in my RxJS bundle being on 36.89 KB. Much better.

screenshot at aug 06 11-24-35

But unfortunately this setting also results in the store's tests failing.