Babel是否在角度5中用作编译器(AOT或JIT)

RK6*_*RK6 5 angular2-aot angular angular5

在Angle 5应用程序中需要Babel吗?内部使用什么AOT或JIT进行编译?

tat*_*tsu 6

您无需担心Angular 2+应用程序中的Babel。

您可以在项目的tsconfig.app.json文件中配置ECMAscript级别。

(确保您使用angular的angular-cli启动了项目)

示例(角度8):

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "types": []
  },
  "exclude": [
    "node_modules",
    "test.ts",
    "**/*.spec.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

示例(角度5):

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015", //<-- can aslo be es5 es6 es7
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

打字稿,angular的文件系统包括JS生物圈中存在的所有其他东西的非常完整的捆绑包:

  • ECMAscript(ergo babel)
  • 咖啡脚本
  • ...