gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 10:19:09 30 4
gpt4 key购买 nike

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

the problem

enter image description here

包-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

最佳答案

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

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

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

关于angular-cli - Angular 8,ng build 编译两次并复制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56970292/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com