Do we need Babel in an Angular 5 application? What AOT or JIT is being used internally to compile?
Asked
Active
Viewed 9,379 times
11
-
Where could you find Babel in Anuglar 5? – Kelvin Lai Apr 24 '18 at 10:43
-
1@RK6 did my answer solve your issue? – tatsu Apr 25 '18 at 15:34
-
Yes, thank you for the clarification @tatsu – RK6 Apr 26 '18 at 12:40
-
thank you! would care to mark me as answer (checkmark next to the answer) so that in the future, people searching for answers with the same problem will see this as resolved in the results and click on it instead of ignoring it? thanks :) – tatsu Apr 26 '18 at 13:17
-
Done it. Thank you – RK6 Apr 27 '18 at 04:18
1 Answers
12
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 :
- ECMAscript (ergo babel)
- coffeescript
- ...

tatsu
- 2,316
- 7
- 43
- 87
-
`error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.` – Lucio Sep 16 '19 at 14:24
-
in latest version of angular (8) module is not even there. try updated version (or just use angular-cli to create that file, don't make it yourself) – tatsu Sep 16 '19 at 14:29
-
forgive me the ignorance tatsu, but where did you configure ECMAScript in Angular 8+??, in Angular 5 it is visible that it was in modules, but I didn't see in angular 8 explicitly – Edson Filho Jul 06 '21 at 18:26