Angular 8,ng build编译两次并复制文件

时间:2019-07-10 12:01:45

标签: angular-cli

我已经在Angular 8中启动了一个新项目,当执行ng build两次角度编译时,我想知道为什么

the problem

enter image description here

package-json:

{
  "name": "portability",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.1.0",
    "@angular/cdk": "^8.0.2",
    "@angular/cli": "^8.1.0",
    "@angular/common": "~8.1.0",
    "@angular/compiler": "~8.1.0",
    "@angular/core": "~8.1.0",
    "@angular/flex-layout": "^8.0.0-beta.26",
    "@angular/forms": "~8.1.0",
    "@angular/material": "^8.0.2",
    "@angular/platform-browser": "~8.1.0",
    "@angular/platform-browser-dynamic": "~8.1.0",
    "@angular/router": "~8.1.0",
    "@ngx-translate/core": "^11.0.1",
    "core-js": "^2.5.4",
    "hammerjs": "^2.0.8",
    "rxjs": "~6.5.2",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.801.0",
    "@angular/compiler-cli": "~8.1.0",
    "@angular/language-service": "~8.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.4.5"
  }
}

节点版本:v10.16.0

npm版本:6.10.0

1 个答案:

答案 0 :(得分:2)

这是Angular 8的新功能,称为差异加载

您看到的两个单独的版本是针对不同的浏览器目标的-用户使用的浏览器确定了angular将提供哪些文件。

新的浏览器将获得具有现代语言功能的代码,而旧的浏览器将获得稳定的旧代码。