树摇动RxJS Angular 5

时间:2018-01-31 18:02:24

标签: angular rxjs

我使用ng cli创建了一个全新的Angular项目,但没有添加任何内容。然后我跑了

ng build --prod --aot -vc = true -sm -oh = none

我用source-map-explorer查看树震动的内容。我看到一堆rxJs我没有使用的东西,比如可观察,合并图等等。这是正常的吗?这是因为其他节点模块正在使用它,比如angular?是我的供应商捆绑的14%。

Angular CLI: 1.5.0
Node: 6.11.0
OS: win32 x64
Angular: 5.2.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.17
typescript: 2.4.2
webpack: 3.8.1

"dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  }

enter image description here

1 个答案:

答案 0 :(得分:1)

在您的依赖项中,许多@angular模块/组件使用rxjs,因此在每个组件中,树形抖动发生在导入到每个相应角度模块/组件的运算符上。

特别是角度路由器,它都是可观察的。