Today I installed Angular 8 final version.
npm install -g @angular/cli
Generated a simple app with:
ng new sampleApp
On https://angular.io/guide/ivy site I found that I have to modify tsconfig.app.json
file to enable Ivy. Like this:
"angularCompilerOptions": {
"enableIvy": true
}
My question is after I perform build how can I verify that Ivy is in place and used as a rendering engine?
Using Ivy in an existing project : To update an existing project to use Ivy, set the enableIvy option in the angularCompilerOptions in your project's tsconfig. app. json . AOT compilation with Ivy is faster and should be used by default.
The value of the enable Ivy flag is set to true by default, as of version 9. The following example shows how to set the enable Ivy option to false in order to opt-out of Ivy. If you disable Ivy, you might also want to reconsider whether to make the AOT compilation the default for your application development.
In version 9, Ivy is the default. For compatibility with current workflows during the update process, you can choose to opt out of Ivy and continue using the previous compiler, View Engine.
Ivy is much more efficient than ViewEngine. For each component in Angular less code is generated since the compiler removes the unused parts of Angular. This has a huge impact on the size of the app. The difference in bundle size between Angular 8 apps and Angular 9 apps is almost 40%.
New rendering engine prefers adding expando properties to many objects rather than new wrapping type.
You can open your application in chrome browser and check if any of elements inside your Angular application has __ngContext__
property.
https://ivy.ng-run.com/
When you set enableIvy
to true
...
"angularCompilerOptions": {
"enableIvy": true
}
...
then ngcc
command is executed by running ng serve
or ng build
. You can recognize it in the console easily because it will start printing out something like this
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
...
The seconds possible way is by checking bundle size as it was mentioned in comments.
Also there is a short paragraph about Ivy and Bazel on Angular blog that we will get more info about Ivy next week.
We know there’s lots of excitement for our forthcoming opt-in previews. We’ll be providing individual updates on these next week on this blog, so stay tuned!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With