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
Dynamic component not working on prod mode with Ivy enabled #19321
The issue is caused by package @angular/common and @angular/core
Is this a regression?
Yes, it doesn't work with ivy compilation but works with View Engine
Description of the problem:
When creating a dynamic component to load html at runtime, the *ngIf, *ngFor, etc... directives and all components of the commonModule are not loaded whereas we have imported the commonModule in the dynamically loaded module.
Actually, all the imports are ignored. This happens only in production mode when building in dev mode there is no issue.
Also , it is working with Ivy disabled even in prod mode.
so to summarized
dev mode and ivy enabled : it works
prod mode and ivy enabled : it DOESN'T work
dev mode and ivy disabled: it works
prod mode and ivy disabled: it works
Transferring to CLI as that's where the optimization occurs.
When AOT is enabled, the CLI uses the GLOBAL_DEFS_FOR_TERSER_WITH_AOT constant which includes ngJitMode: false, such that code relevant for JIT is dropped.
This is related to #17663 and #19016 but those are about Build Optimizer, whereas that is already disabled here.
AOT+JIT interop with any build optimizations is not a supported path and we don't recommend this approach to be used for production. The main reasons are that this approach increases drastically the bundle sizes, performance overhead and exposes your application to cross-site scripting (XSS) since compiling components at runtime is a XSS vulnerability in itself.
Activity
JoostK commentedon Nov 8, 2020
Transferring to CLI as that's where the optimization occurs.
When AOT is enabled, the CLI uses the
GLOBAL_DEFS_FOR_TERSER_WITH_AOTconstant which includesngJitMode: false, such that code relevant for JIT is dropped.This is related to #17663 and #19016 but those are about Build Optimizer, whereas that is already disabled here.
alan-agius4 commentedon Nov 10, 2020
Hi all,
AOT+JIT interop with any build optimizations is not a supported path and we don't recommend this approach to be used for production. The main reasons are that this approach increases drastically the bundle sizes, performance overhead and exposes your application to cross-site scripting (XSS) since compiling components at runtime is a XSS vulnerability in itself.
I created an issue to capture and document this: angular/angular#39624
angular-automatic-lock-bot commentedon Dec 11, 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.