While reading about AOT in Angular from here, I can across the flow of how actually the .ts
files are loaded to browsers. Being new to Angular, I would be really grateful if someone can explain me the inner working of how it all works. I tried to search on google but there are no question where this has been explained.
With angular2, if you go with JIT (which is default), both the compiles happen after the code is loaded in the browser (i.e. TS -> JS -> binary). Not only is it an additional overhead to do the TS -> JS compilation on the fly on the browser, but also, the angular2 compiler is almost half the size of the angular2 package so if we avoid this, we can reduce the size of the payload significantly.
My question against above paragraph:
- How does
both the compiles happen after the code is loaded in the browser
happen ? I mean, doTypeScript compiler
does this ? - where does TypeScript compiler resides which converts TS to JS files ? is it on the local dev server ?
Basically I want to know how the ts
gets rendered in Angular
. I hope it's a good question to be asked on SO.