AOT is not working with the serve command.
AOT is working with the serve command to test the production app in the browser. (At a higher recompilation cost.)
Steps to reproduce:
ionic serve --prod or Start ionic serve --aotWhich @ionic/app-scripts version are you using? 1.0.0
Hi @NoNameProvided,
Sorry, we don't intend to support this. An option for you to accomplish this would be running npm run ionic:build --aot and then just serving/opening the index.html file manually.
Thanks,
Dan
Yes thats what I am doing at the moment.
I see some place for easy improvement. From the README:
By default the build and serve tasks produce dev builds (a build that does not include Ahead of Time (AoT) compilation or minification). To force a prod build you should use the --prod command line flag.
It should be better outlined that --aot only works with ionic serve. For the first time I have read this, it meant to me that "prod build" is an ionic serve or ionic build command with the --prod arg. Maybe some note should be added like:
Please note that the
--prodand--aotworks only with theionic buildcommand.
Also can't we add some command line warning when ionic serve is called with an --aot or
--prod arg?
Could this be a good feature for the future?
--aot does not work with serve. It will likely work for one build and then fail. We have no intentions of supporting this. Ideally, once AOT is ready for it, we'll use AoT for every build. It's not there yet, though.
There are some intriguing "hacks" that we're watching closely. We want to always use AoT if possible.
Thanks,
Dan
@danbucholtz, that's great. I'll certainly use it.
@danbucholtz , So right now the best approach for good production based app is- ionic serve --prod?
Most helpful comment
--aotdoes not work with serve. It will likely work for one build and then fail. We have no intentions of supporting this. Ideally, once AOT is ready for it, we'll use AoT for every build. It's not there yet, though.There are some intriguing "hacks" that we're watching closely. We want to always use AoT if possible.
Thanks,
Dan