store icon indicating copy to clipboard operation
store copied to clipboard

Importing NgReduxModule includes full RxJS bundle

Open danielcrisp opened this issue 5 years ago • 0 comments

This is a...

  • [ ] feature request
  • [x] bug report
  • [ ] usage question

What toolchain are you using for transpilation/bundling?

  • [x] @angular/cli
  • [ ] Custom @ngTools/webpack
  • [ ] Raw ngc
  • [ ] SystemJS
  • [ ] Rollup
  • [ ] Other

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.

danielcrisp avatar Aug 06 '18 10:08 danielcrisp