If you are getting the error An unhandled exception occurred: The 'buildOptimizer' option cannot be used without 'aot'. or some variation of that while using ng build or ng deploy, then here is the solution that worked for me (scroll down).
angular.json file"buildOptimizer" to true and add "aot" to true as wellThe above commands should work now.
ADDON: If you have that problem with ng serve or ng test, you could try replacing build in step 2 with serve or test respectively (Disclaimer: I have not tested that).
When I upgrade from angular 11 to angular 13 I see this error during command ng serve. To fix it I created a brand new angular project with the "@angular/cli" and imitate the angular.json of the new project.
inside angular.json projects>MY_PROJECT_NAME>architect>build>configurations added a development with json
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
under ...serve>configurations added
"development": {
"browserTarget": "hasap:build:development"
}
under ...serve> added "defaultConfiguration": "development"
You can see the details of changes in angular.json from my commit https://github.com/canbax/hasap/commit/9c0fc95fc244d35b2d7ee70c7048f6b38bd213b5
I used the production configuration to serve my project
ng serve -o --ssl true --configuration production
This will use the buildOptimizer and the aot issue.