angularangular5angular2-aot

Is Babel being used as compiler (AOT or JIT) in angular 5


Do we need Babel in an Angular 5 application? What AOT or JIT is being used internally to compile?


Solution

  • You don't need to worry about babel in an angular 2+ application.

    You configure the ECMAscript level in the tsconfig.app.json file in you project.

    (be sure you initiated your project with angular's angular-cli)

    example (angular 8):

    {
      "extends": "../tsconfig.json",
      "compilerOptions": {
        "outDir": "../out-tsc/app",
        "baseUrl": "./",
        "types": []
      },
      "exclude": [
        "node_modules",
        "test.ts",
        "**/*.spec.ts"
      ]
    }
    

    example (angular 5) :

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

    typescript, angular's filesystem includes a very complete bundle of all the other goodies there exist in the JS biosphere :