Support for AoT compilation
Are there any plans to support AoT compilation in angular-cli?
@elvirdolic i believe AoT compilation is a perquisite to declaring an 1.0 release. So while it is not there right now it will be there as we approach an official release of angular2
We definitely plan on having it, but I don't have a timeline to give. It's a big thing on our radar though.
@elvirdolic just an fyi I have gotten an angular-cli build working with AOT compilation so it is possible to roll it yourself for now if you want to play around with it.
@deebloo please provide us the steps to make AOT on cli webpack
@deebloo it would be very useful to me too, and I am sure also to other people. Thanks!
Any luck with AOT? We're using Angular2 in production, is there a hack to make it work with [email protected]?
Yeah also interested. Is this possible with the "old" systemjs angular-cli? As I can't upgrade to webpack due to some other issues.
This repo provides some hacks. Check it out
https://github.com/brandonroberts/router-cli-aot/blob/master/README.md
@elvirdolic this is not webpack
I've just played with angular-cli all day and I must say that it is AWESOME 💯 ! But I miss the AoT compilation thu. Is there any progress? When can I expect a working prototype? Is it a matter of days or rather weeks? Thanks for your answer.
Yes in the latest version you can try ng build --prod --aot. But its not officially described in the docs.
@elvirdolic 👍
I have a question... what is actually happen, when I add --aot flag? In angular.io docs, there is a tutorial for AoT compilation that includes 2 changes, one in tsconfig (for ngc) and second in main.ts (replace platform-browser-dynamic with platform-browser). If I do these changes, build with --aot stop working. If I keep them without any change, --aot works but I think that it still keeps platform-browser-dynamic in the bundle and loads JiT... isn't it?
edit: and if changes in tsconfig.json and main.ts are required, how can I change config for dev and production to use e.g. main.ts or main.aot.ts respectively?
I think you don't have to change anything. This is the magic of angular-cli you don't have to worry about that. Use the flag and the rest will be done in the background. Aot is still in WIP. Lets wait for a official relase statement maybe there is some config change required.
i am sorry but what is AoT?
@elvirdolic: correct, there is NO config change needed for AoT, and we're making sure that it's backward compatible with your project. Some extreme cases might confuse our tooling so it will error out, but this should only happen if do strange things (such as declaring your classes but exporting them by another name, for example). If you follow the blueprints, and even if you do some code yourself, it should work just fine.
@k1ng440: AoT is ahead-of-time compilation. Look up "Angular 2 AoT" on youtube to see what's it about.
@hansl is this feature usuable? Should I expect to run ng serve --aot and all is working? Or should I do something else?
@jordic ng build --prod --aot and ng serve --prod --aot works in beta.16, but there are still some issues to solve (like infinite server rebuild in ng serve --aot in development mode)
@castamir didn't see the note the mention about infinite rebuild, was too excited about having AOT. Here is the issue for anyone curious https://github.com/angular/angular-cli/issues/2418
@castamir not works aot with lazy routes
Ok @castamir. Not sure if this is the place to ask this, but when I launch ng serve --aot I've got this error:
Error encountered resolving symbol values statically. Reference to a non-exported function (position 17:10 in the original .ts file), resolving symbol MemoryBoardComponent
Are there any step I missed, or there is something in my codebase not properly defined/structured? May someone give and advice?