簡體   English   中英

為什么將整個 rxjs 導入到功能角模塊中

[英]Why whole rxjs is imported on a feature angular module

我正在分析我的 angular 應用程序包,我不明白為什么在一個功能模塊1.b6e2bed6d2a2d3892bd9.chunk.js導入1.b6e2bed6d2a2d3892bd9.chunk.js ,我在該模塊中導入的所有內容如下:

import { Observable } from 'rxjs/Observable';

webpack-bundle-分析器

如何找出為什么在該模塊上導入整個 rxjs?

答:我找到了問題的根源,我在那個模塊上導入 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
        ]
    };
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM