You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.
Have we considered using named exports for specific methods so that we don't immediately require the entire RxJS bundle on behalf of the user (of this library)?
The benefit is that we are no longer pulling in the entire RxJS library for this library to work. But the downside is that the user needs to manually add in their own methods (because the observable passed to them will be "barebones").
For example, the observable the user gets back from fromComponent() will not have methods like .share() or .debounceTime(). They would need to add it themselves explicitly like this:
One option to get around this is to simply provide both options to the user. Maybe something like this:
// Imports the whole RxJS bundleimport{observeComponent,fromComponent}from'observe-component/rxjs/full';// Imports only the necessary objects and methodsimport{observeComponent,fromComponent}from'observe-component/rxjs';
The library might get bigger, but this gives the developer much more control if he wants to keep the bundle size small for production
The text was updated successfully, but these errors were encountered:
adrianmcli
changed the title
Named export for
Named export for requiring RxJS
Jan 9, 2017
That's a really good point. Controlling bundle size is a big deal today with so many large front-end applications, often supported by even larger libraries.
My instinct is to go with "easy/ergonomic by default," which is why I'm leaning towards leaving it as is. Perhaps instead of offering an rxjs/full option, instead having an rxjs/lite for people who desire more fine-grained control over which RxJS methods are imported?
Yeah that's a good point. I can make a stab at doing this over the weekend, but unfortunately I don't know any Typescript. I just started a new job which requires Typescript though, so I'll probably be able to help very soon!
Have we considered using named exports for specific methods so that we don't immediately require the entire RxJS bundle on behalf of the user (of this library)?
It would mean replacing this:
With this:
The benefit is that we are no longer pulling in the entire RxJS library for this library to work. But the downside is that the user needs to manually add in their own methods (because the observable passed to them will be "barebones").
For example, the observable the user gets back from
fromComponent()
will not have methods like.share()
or.debounceTime()
. They would need to add it themselves explicitly like this:One option to get around this is to simply provide both options to the user. Maybe something like this:
The library might get bigger, but this gives the developer much more control if he wants to keep the bundle size small for production
The text was updated successfully, but these errors were encountered: