Is there a difference between importing {Observable} from 'rxjs / Observable' and import {Observable} from 'rxjs'?

When using rxjs in angular 2, is there a difference between import { Observable } from 'rxjs/Observable' and also import { Observable } from 'rxjs' ?

+6
source share
1 answer

Yes, there is a slight difference, which is the size of the package. Unless you use a tree-like library like rollup.js that removes all unnecessary codes, your package will be large when importing from "rxjs" when importing everything, even if you use only Observable. On the other hand, if you import from "rxjs / Observable", you only import what you need and the package will be smaller.

Import only what you need and the Observable patch (this is useful in size-based scripts)

Link: https://github.com/ReactiveX/rxjs

+8
source

Source: https://habr.com/ru/post/1014758/


All Articles