[英]Why do i get too many rxjs file calls in my angular 2 project? (seems to be all of them)
EDIT: i have another project thats also not packaged up, and has calls for observable,subscription,subscriver (and BehaviorSubject).
编辑:我还有另一个项目也没有打包,并要求可观察,订阅,订阅(和BehaviorSubject)。 this project however uses those three but not BehaviorSubject.
但是,该项目使用这三个对象,但不使用BehaviorSubject。
in the other project it makes 63 rxjs calls, and in this project it makes 340 rxjs calls
在另一个项目中,它进行了63次rxjs调用,在该项目中,它进行了340次rxjs调用
I'm asking where to look for what is making those calls (both projects are same in their..settings... both using systemjs,bot run in JIT compilation (for now)
我要问在哪里寻找发出这些调用的内容(两个项目的..settings都相同...都使用systemjs,在JIT编译中运行的机器人(目前)
im using Observables, subscription etc in my project, and everytime i import i import them specifically 即时通讯在我的项目中使用Observables,subscription等,每次我导入时,我都会专门导入它们
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
also no lines that are like 也没有像
import "rxjs/Rx";
anywhere in the project, but still, when the project starts, it calls for 340 files 在项目中的任何位置,但仍然在项目启动时需要340个文件
That's because those imports have imports of their own. 那是因为这些进口有自己的进口。 For instance if you do:
例如,如果您这样做:
import 'rxjs/add/operator/map';
And look inside map what it imports, and look another level deeper you get: 并查看map导入的内容,然后再深入一遍:
import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { Observer, PartialObserver } from './Observer';
import { Operator } from './Operator';
import { Subscriber } from './Subscriber';
import { Subscription, AnonymousSubscription, TeardownLogic } from './Subscription';
import { IfObservable } from './observable/IfObservable';
import { ErrorObservable } from './observable/ErrorObservable';
... etc, because some of these imports will import other stuff as well, you get that chain of all the files, but still, this is by far not the entire rxjs
library, and with a good package manager (or by using the angular-cli), the final bundle will only contain what's actually necessary for your app ...等等,因为其中一些导入也将导入其他内容,所以您将获得所有文件的链,但是,到目前为止,这还不是整个
rxjs
库,并且具有良好的程序包管理器(或通过使用angular-cli),最终的捆绑包将仅包含您的应用实际需要的内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.