不再需要 core-js 了吗? [英] Is not core-js needed anymore?

查看:31
本文介绍了不再需要 core-js 了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将一个 Angular 项目从版本 7 更新到了 8.一切运行顺利,原理图完成了它的工作(也许),我们还好(项目甚至在生产中).当我们更新 Angular CLI 时,我们总是会生成一个新项目来查看真正的差异并从中学习,例如新的依赖项、配置等.

I've updated an Angular project from version 7 to 8. Everything runs smoothly, schematics did it's job (maybe) and we are Ok (project is even in production). When we're updating Angular CLI, we always generate a new project to see the real differences and learn from them such as new dependencies, configurations, etc.

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

When generating a new Angular project with Angular CLI 8.0.4, the new app doesn't have core-js as dependency:

"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 不存在:在我的项目中,使用 Angular CLI 进行了更新,core-js 在那里并且存在于最终包中:

Analyzing bundle on built project core-js is not there: On my older project, updated with Angular CLI, core-js is there and is present in the final 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 作为依赖项是否安全?更新原理图是否缺少这个?在最新项目上安装 npm 依赖项时,我从 core-js 获得安装后消息,但它没有明确出现在包描述中.

Why is this behavior? Is it safe to remove core-js as dependency? Does update schematics missing this? When installing npm dependencies on the newest project I get the post-install messages from core-js, but it is not explicitly present in package description.

推荐答案

根据 这篇 文章.

请注意,core-js 已更新到 v3,现在由 CLI 本身直接处理,因此不再需要它作为应用程序的依赖项.

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.

这篇关于不再需要 core-js 了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆