mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Before standalone, everything that could appear in an NgModule's `imports` was relevant to DI, and needed to be emitted in the `imports` of the generated `InjectorDef` definition. With the introduction of standalone types, NgModule `imports` can now contain components, directives, and pipes which are standalone. Only standalone components need to be included in the `imports` of the generated injector definition - directives and pipes have no effect on DI. Having them present doesn't cause any errors in the runtime (they're filtered out by the injector itself) but it does prevent tree-shaking. With this commit, the generation of `InjectorDef` now filters the `imports` to exclude directives and pipes as much as possible. It's not _always_ possible because an expression in `imports` may pull in both a directive and a `ModuleWithProviders` reference, and we have no way of referencing just the MWP part of that expression. Therefore this is an optimization, not a rule of `InjectorDef` compilation. PR Close #45701 |
||
|---|---|---|
| .. | ||
| 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 | ||