如何为Angular 8或9启用Ivy? [英] How do I enable Ivy for Angular 8 or 9?

查看:74
本文介绍了如何为Angular 8或9启用Ivy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Angular 8或9项目上启用Ivy?

How do I enable Ivy on a Angular 8 or 9 project?

Ivy是即将推出的Angular渲染引擎,它引入了许多不错的功能,而无需更改Angular项目的当前代码库.

Ivy is the upcoming render engine for Angular which introduces a lot of nice features without changing the current code base of Angular projects.

推荐答案

源和更多信息通过

参考文献:: https://dzone.com/articles/how-to-upgrade-angular-packagesenable-ivy-compiler

您可以自动升级

npm i -g @angular/cli@latestng update

或在您的tsconfig.json文件中 更新

{
  "compilerOptions": {
    "module": "esnext",
    // ...
  },
  "angularCompilerOptions": {
    "enableIvy": true,
    "allowEmptyCodegenFiles": true
  }
}

然后创建您的angular.json文件

{
  "projects": {
    "your-project": {
      "architect": {
        "build": {
          "options": {
            ...
            "aot": true,
          }
        }
      }
    }
  }
}

这篇关于如何为Angular 8或9启用Ivy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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