mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Angular generally supports cycles between components in the same NgModule. We have a mechanism of moving the component scope declaration into the NgModule file in this case. This ensures that Angular never itself introduces an import which creates a cycle. What happens if the cycle already exists in the user's program, though, is a bit different. In these cases, the "correct" emit for Angular is to generate the component scope (whether direct or remote) inside of a closure, to prevent evaluating the scope's references until module evaluation is complete and all cyclic imports have been resolved. We don't want to do this for *all* scopes because the code size cost of emitting a function wrapper is non-zero. In this fix, we take the presence of a `forwardRef` in a component's `imports` or in an NgModule `declarations` or `imports` as a sign that component scopes emitted into those files need to be protected against cyclic references. In a future commit, we may introduce a warning or error if cyclic imports are not protected behind `forwardRef` in these cases, but this will take some time to implement. PR Close #46139 |
||
|---|---|---|
| .. | ||
| compliance | ||
| ngtsc | ||
| BUILD.bazel | ||
| downlevel_decorators_transform_spec.ts | ||
| extract_i18n_spec.ts | ||
| mocks.ts | ||
| perform_compile_spec.ts | ||
| perform_watch_spec.ts | ||
| test_support.ts | ||
| typescript_support_spec.ts | ||
| version_helpers_spec.ts | ||