angular/goldens/public-api/compiler-cli
Payam Valadkhan e8201a5962 refactor(compiler-cli): add a compiler option to enable checking for orphan component (#52061)
Orphan component is an anti-pattern in Angular where a component is rendered while the NgModule declaring it is not installed. It is not easy to capture this scenario, specially in compile time. But it is possible to capture a special case in runtime where the component is being rendered without its NgModule even loaded into the browser. This change adds a flag in cli compiler option to enable such checking, and throwing a runtime exception if it happens. Note that such check is only done in dev mode.

Currently the check requires some generated code that is behind ngJitMode flag (i.e., call to ɵɵsetNgModuleScope), and the new flag can be set only if JIT mode is enabled (i.e., supportJitMode=true) otherwise an error will be thrown.

The orphan component is a main blocker for rolling out local compilation in g3. This option is needed for identifying and isolating such cases.

PR Close #52061
2023-10-10 15:30:26 -07:00
..
compiler_options.md refactor(compiler-cli): add a compiler option to enable checking for orphan component (#52061) 2023-10-10 15:30:26 -07:00
error_code.md feat(core): Provide a diagnostic for missing Signal invocation in template interpolation. (#49660) 2023-10-10 11:55:13 -07:00
extended_template_diagnostic_name.md feat(core): Provide a diagnostic for missing Signal invocation in template interpolation. (#49660) 2023-10-10 11:55:13 -07:00