gpt4 book ai didi

angular - 不再需要core-js了吗?

转载 作者:行者123 更新时间:2023-12-03 07:31:10 25 4
gpt4 key购买 nike

我已经将Angular项目的版本从7更新到了8。一切运行顺利,原理图已完成(也许),并且我们还可以(项目甚至还在生产中)。在更新Angular CLI时,我们总是生成一个新项目以查看实际差异并从中学习,例如新的依赖项,配置等。

当使用Angular CLI 8.0.4生成新的Angular项目时,新应用程序没有core-js作为依赖项:

"dependencies": {
"@angular/animations": "~8.0.1",
"@angular/common": "~8.0.1",
"@angular/compiler": "~8.0.1",
"@angular/core": "~8.0.1",
"@angular/forms": "~8.0.1",
"@angular/platform-browser": "~8.0.1",
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/router": "~8.0.1",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
}

不存在分析已构建项目 core-js上的包的信息:
Bundle without core-js
在我的较旧项目中,使用Angular CLI更新了该项目, core-js存在于最终 bundle 包中:
"dependencies": {
"@angular/animations": "~8.0.3",
"@angular/cdk": "~8.0.1",
"@angular/common": "~8.0.3",
"@angular/compiler": "~8.0.3",
"@angular/core": "~8.0.3",
"@angular/forms": "~8.0.3",
"@angular/platform-browser": "~8.0.3",
"@angular/platform-browser-dynamic": "~8.0.3",
"@angular/router": "~8.0.3",
"@auth0/angular-jwt": "2.1.1",
"@hackages/ngxerrors": "~8.0.0",
"@ng-bootstrap/ng-bootstrap": "5.0.0-rc.1",
"@ngx-loading-bar/core": "~4.2.0",
"@ngx-loading-bar/http-client": "~4.2.0",
"@nicky-lenaers/ngx-scroll-to": "~2.0.0",
"@swimlane/ngx-charts": "~12.0.1",
"bootstrap": "~4.3.1",
"core-js": "~2.6.9",
"d3-scale": "~3.0.0",
"d3-shape": "~1.3.5",
"date-fns": "2.0.0-beta.2",
"ngx-perfect-scrollbar": "~8.0.0",
"ngx-toastr": "~10.0.4",
"rxjs": "~6.5.2",
"tslib": "~1.10.0",
"xlsx": "~0.14.3",
"zone.js": "~0.9.1"
}

core-js present in final bundle

为什么会这样呢?删除 core-js作为依赖关系是否安全?更新原理图会丢失吗?在最新项目上安装 npm依赖项时,我从 core-js获得了安装后消息,但是在软件包描述中未明确显示该消息。

最佳答案

根据this的文章。

Note that core-js has been updated to v3, and is now directly handled by the CLI itself, so it’s no longer needed as a dependency of your application.

关于angular - 不再需要core-js了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56892243/

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