Skip to content

Why is file size so big? #3971

@bcherny

Description

@bcherny

I'm using RxJS6 in Undux, via typed-rx-emitter. I use it by importing Observable, and calling Observable.create. I don't use any other Rx methods.

Bundling Undux (+typed-rx-emitter, +rxjs) in as part of undux-todomvc, I see all sorts of things included in the bundle that I'm not using. Eg:

  • CombineLatestOperator
  • MergeMapOperator
  • MapOperator
  • RaceOperator
  • ZipOperator
  • AsyncSubject
  • BehaviorSubject
  • Subject
  • ReplayEvent
  • AsapScheduler
  • VirtualTimeScheduler
  • ForkJoinSubscriber
  • ZipBufferIterator

All in all, that's ~80kb (unmangled). Even after running the code through Uglify's tree shaker, these are included. Are they core parts of Rx.Observable.create? Is there a way to remove them? Am I doing something wrong when bundling?

Repro:

Generated bundle.js (after Uglify)

Uglify options:

new UglifyJsPlugin({
  cache: true,
  parallel: true,
  sourceMap: true,
  uglifyOptions: {
    keep_classnames: true,
    keep_fnames: true,
    mangle: false
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions