为什么在特征角度模块

时间:2017-10-21 10:29:33

标签: angular rxjs bundle

我正在分析我的角度应用程序包,我无法理解为什么在一个要素模块1.b6e2bed6d2a2d3892bd9.chunk.js上导入rxjs,我在该模块中导入的所有内容如下所示:

import { Observable } from 'rxjs/Observable';

webpack-bundle-analyzer

如何找出为什么在该模块上导入整个rxj?

1 个答案:

答案 0 :(得分:1)

答案: 我找到了问题的根源,我正在该模块上导入customHttpProvider,我猜ng-jhipster包拉了整个rxjs

import { Injector } from '@angular/core';
import { Http, RequestOptions, XHRBackend } from '@angular/http';
import { JhiInterceptableHttp } from 'ng-jhipster';
import { AuthExpiredInterceptor } from './auth-expired.interceptor';
import { ErrorHandlerInterceptor } from './errorhandler.interceptor';
import { NotificationInterceptor } from './notification.interceptor';

export function interceptableFactory(
    backend: XHRBackend,
    defaultOptions: RequestOptions,
    injector: Injector
    //stateStorageService: StateStorageService,
    //eventManager: EventManager
) {
    return new JhiInterceptableHttp(
        backend,
        defaultOptions,
        [
            new AuthExpiredInterceptor(injector
              //, stateStorageService
            ),
            // Other interceptors can be added here
            new ErrorHandlerInterceptor(
              //eventManager
            ),
            new NotificationInterceptor()
        ]
    );
};

export function customHttpProvider() {
    return {
        provide: Http,
        useFactory: interceptableFactory,
        deps: [
            XHRBackend,
            RequestOptions,
            Injector,
            //StateStorageService,
            //EventManager
        ]
    };
};