You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
platformBrowser().bootstrapModule does not work under Closure Compiler ADVANCED_OPTIMIZATIONS #36618
When compiling an application with Ivy (aot: true) with an entry point that contains platformBrowser().bootstrapModule(AppModule) and then running it through the Closure Compiler's advanced optimizations:
BrowserModule's providers are removed as dead code which causes the application to fail to bootstrap with the error "No ErrorHandler. Is platform module (BrowserModule) included?"
Compiling the same application with Closure's simple optimizations:
Application renders as expected.
Changing the entry point to use ɵrenderComponent(AppComponent) and using advanced optimizations:
Simple application renders as expected.
Complex app fails with '${type.name}' is neither 'ComponentType' or 'DirectiveType'. for just about every Angular-owned dependency (e.g. RouterModule)
It turns out ɵrenderComponent worked for the simple example I built, but doesn't work for an application that has deps on anything published by Angular (e.g. RouterModule). I've edited the original post to reflect this.
I've confirmed that #36652 does actually fix this, and I was able to successfully bootstrap our application using Ivy and advanced optimizations with that patch applied.
Activity
DavidANeil commentedon Apr 15, 2020
It turns out
ɵrenderComponentworked for the simple example I built, but doesn't work for an application that has deps on anything published by Angular (e.g. RouterModule). I've edited the original post to reflect this.DavidANeil commentedon Apr 15, 2020
Closure is changing something like
To
DavidANeil commentedon Apr 15, 2020
I'm 90% certain that having
ngccemit/** @nocollapse */comments would fix this.DavidANeil commentedon Apr 16, 2020
I've confirmed that #36652 does actually fix this, and I was able to successfully bootstrap our application using Ivy and advanced optimizations with that patch applied.
fix(ngcc): use annotateForClosureCompiler option
fix(ngcc): use annotateForClosureCompiler option (#36652)
fix(ngcc): use annotateForClosureCompiler option (angular#36652)
angular-automatic-lock-bot commentedon Jul 12, 2020
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(ngcc): use annotateForClosureCompiler option (angular#36652)