Why did Angular design two compilation methods for JIT/AOT? Why do you provide @ angular/platform-browser and @ angular/platform-browser-dynamic packages?
as we know, Angular provides @ angular/compiler and @ angular/compiler-cli compiler packages. JIT (just in time) downloads compiler to the browser, where the Angular components and modules, in the ts file are compiled into js files in real time at run time, while AOT (ahead of time) compiles the Angular components and modules, in the ts file into js files using compiler in the build phase. According to this article on Medium, Angular: Is AOT Worth It? , Angular initially had only JIT,. Then Tobias Bosch and Misko Hevery thought of using @ angular/compiler and @ angular/compiler-cli to compile Angular components and modules code during the compilation phase, resulting in AOT compilation. So knowing that JIT/AOT differs only in the compilation phase, you use the same @ angular/compiler and @ angular/compiler-cli compilers to compile the code.
the official website also focuses on ide/aot-compiler" rel=" nofollow noreferrer "> AOT compile , and explains the benefits of AOT and how the Angular compiler package compiles the code. When we developers use Angular, we developers will also use the @ angular/cli tool to compile code using AOT (now @ angular/cli also uses AOT), by default). Although we also know that @ angular/cli also uses @ ngtools/webpack package ngcLoader and AngularCompilerPlugin as custom Webpack Loader and Plugin access to Webpack , Achieve the purpose of loading and compiling Angular components and modules.
so why doesn"t Angular discard JIT and just use AOT? can"t this simplify Angular?
it is precisely because Angular has two ways: JIT and AOT. So two packages are provided for the browser platform: @ angular/platform-browser-dynamic and @ angular/platform-browser . Imagine that if you had only AOT, you would only need one package, which would simplify Angular very much.
in practice, I think most projects will choose AOT instead of JIT.
so why doesn"t Angular discard JIT and just use AOT? doesn"t that simplify Angular?
so why doesn"t Angular discard JIT and just use AOT? can"t it simplify Angular?
so why doesn"t Angular discard JIT and just use AOT? can"t it simplify Angular?