简体   繁体   English

为什么在我的angular 2项目中收到太多rxjs文件调用? (似乎都是他们)

[英]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.

相关问题 过滤来自Web Api调用的Angular中的数据似乎让我做了大量工作 - Filtering data in Angular that comes from Web Api calls seems that I get a lot of scrubbing to do 如何在我的情况下设置Angular http调用 - How do I set Angular http calls in my case 为什么我看不到用firefox更新的角度项目? - Why I don't see update of my angular project with firefox? 为什么每当我重新启动控制器时,我的socket.on调用都会成倍增加 - Why do my socket.on calls multiply whenever i recenter my controller 为什么这个AngularJs代码不起作用,因为我也尝试运行一些完美的代码,但是我的浏览器也没有运行它们 - why this AngularJs code is not working as i tried to run some perfect codes too but my browser doesn't run them also 角-路由为什么我的控制器两次被调用 - Angular - routing why do I getting my controller 2 times called 为什么我需要在工厂使用angular.copy? - Why do I need to use angular.copy in my factory? 为什么我的Angular服务中需要`$ rootScope。$ apply()`? - Why do I need `$rootScope.$apply()` in my Angular Service? 我在角度控制器中发出太多http请求吗? - Am I making too many http requests in angular controller? 提前输入AngularStrap:$ http调用过多 - Typeahead AngularStrap: too many $http calls
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM