New features and changes in Angular 9:
1. JavaScript Bundles and Performance
The problem of heavy bundle of the Angular build files will be now resolved fully in Angular 9 by introducing Ivy as a default compiler in place of ViewEngine which was used in earlier versions.
The combination with AoT with Ivy will be the best solution to solve the problem of heavy JavaScript bundle.
ViewEngine:
It is the currently compiler to transpile the typescript code to JavaScript.
Used by default till Angular 8.
In Angular 8 we can switch to its alternate Ivy compiler by manually adding the flag enableIvy to true
Ivy:
Ivy is the Angular's next-generation compilation and rendering pipeline. which will be the default compiler from the typescript code to JavaScript code.
AoT with Ivy will improve compilation time and the bundle size of build angular application will be reduced.
Earlier in Angular 8 it was made options to play with Ivy as a beta version, to check the feedback.
Now in Angular 9, it will be the default choice to the compiler.
To use with earlier 8 versions you can preview Ivy:
@angular/core@next for (8.1.x)
@angular/core@latest for (8.0.x)
Enable Ivy in new Project
use the --enable-ivy flag with the ng new command:
ng new demo-Ivy-app --enable-ivy
Enable Ivy in Existing Project:
{
"compilerOptions": { ... },
"angularCompilerOptions": {
"enableIvy": true
}
}
In the tsconfig.app.json file you can enable it by setting the flag enable Ivy to true.
Use with AOT:
In angular.json, enable the flag AOT to true ion the build section
{
"projects": {
"your-project-name": {
"architect": {
"build": {
"options": {
...
"aot": true,
}
}
}
}
}
}
2. Selector-less Bindings and Internationalization Feature