I upgrade angular from 8.2.2 to 9.1.8 according to the official upgrade
Angular CLI: 9.1.6
Node: 12.16.1
OS: win32 x64
Angular: 9.1.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
-----------------------------------------------------------
@angular-devkit/architect 0.901.6
@angular-devkit/build-angular 0.901.6
@angular-devkit/build-optimizer 0.901.6
@angular-devkit/build-webpack 0.901.6
@angular-devkit/core 9.1.6
@angular-devkit/schematics 9.1.6
@angular/cli 9.1.6
@ngtools/webpack 9.1.6
@schematics/angular 9.1.6
@schematics/update 0.901.6
rxjs 6.5.5
typescript 3.6.4
webpack 4.42.0
I am getting errors on CompilerFactory
Uncaught NullInjectorError: StaticInjectorError(Platform: core)[CompilerFactory]:
NullInjectorError: No provider for CompilerFactory!
Below is the main.ts file
platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.log(err));
I checked online, that since angular 9 support Ivy, so the platformBrowserDynamic() should change to platformBrowser(). I change the main.ts to
platformBrowser().bootstrapModule(AppModule).catch(err => console.log(err));
But still get the same No provider for CompilerFactory error. Then I change the main.ts to below
platformBrowser().bootstrapModuleFactory(<any>AppModule).catch(err => console.log(err));
and getting a different error
Uncaught TypeError: Cannot read property 'name' of undefined
Below is difference that add on angular 9 in angular.json file
"options": {
"aot": true,
}
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
}