🐞 Bug report
Command
- serve
Is this a regression?
It seems so. It stopped working after updating cli from 11.0.7 to 11.1.1
Description
Build optimizer breaks serve
(build
will be broken most probably as well) after updating to latest version.
Setting this config values breaks app
"aot": true,
"buildOptimizer": true,
"optimization": true,
However, the following settings work fine
"aot": true,
"buildOptimizer": false,
"optimization": false,
🔬 Minimal Reproduction
Project https://github.com/rfprod/nx-ng-starter
PR with updated dependencies and broken prod build rfprod/nx-ng-starter#201
Configuration reference (this one is broken prod
; however, if buildOptimizer
and optimization
are turned off it will work) https://github.com/rfprod/nx-ng-starter/blob/2ebd5e142861d194be981b8a51d159627fc4686f/angular.json#L146-L163
Command
ng serve client --configuration production
🔥 Exception or Error
TypeError: Cannot read property 'bootstrap' of null
at new il (vendor.js:1)
at sl.create (vendor.js:1)
at vendor.js:1
at u.invoke (polyfills.js:1)
at Object.onInvoke (vendor.js:1)
at u.invoke (polyfills.js:1)
at s.run (polyfills.js:1)
at nd.run (vendor.js:1)
at e.bootstrapModuleFactory (vendor.js:1)
at vendor.js:1
🌍 Your Environment
$ ng version
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 11.1.1
Node: 14.15.4
OS: linux x64
Angular: 11.1.0
... animations, cdk, common, compiler, compiler-cli, core
... elements, forms, language-service, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1101.1
@angular-devkit/build-angular 0.1101.1
@angular-devkit/core 11.1.1
@angular-devkit/schematics 11.1.1
@angular/cli 11.1.1
@angular/flex-layout 11.0.0-beta.33
@schematics/angular 11.1.1
@schematics/update 0.1101.1
rxjs 6.6.3
typescript 4.0.5
I looked at the reproduction. it looks like the TypeScript transformers are not being executed.
The root cause seems to be that transformers are not executed when
skipTemplateCodegen
is set totrue
. This option is only needed when building a library in view engine. Please remove this option from yourtsconfig.json
.Also, looking at your
tsconfig.json
, it does appear that you have various typescript configurations which are not needed/not recommanded.These are:
annotateForClosureCompiler
emitDecoratorMetadata
strictMetadataEmit
skipTemplateCodegen
The following should only be used when building a library in view engine mode.
strictMetadataEmit
skipTemplateCodegen