perf(forms): make FormBuilder and RadioControlRegistry tree-shakable#41126
perf(forms): make FormBuilder and RadioControlRegistry tree-shakable#41126AndrewKushnir wants to merge 2 commits intoangular:masterfrom
FormBuilder and RadioControlRegistry tree-shakable#41126Conversation
|
You can preview 5482ea3 at https://pr41126-5482ea3.ngbuilds.io/. |
FormBuilder class tree-shakableFormBuilder and RadioControlRegistry tree-shakable
FormBuilder and RadioControlRegistry tree-shakableFormBuilder and RadioControlRegistry tree-shakable
|
You can preview ef68a26 at https://pr41126-ef68a26.ngbuilds.io/. |
2b42649 to
acb48ff
Compare
|
You can preview acb48ff at https://pr41126-acb48ff.ngbuilds.io/. |
|
You can preview 419bbe6 at https://pr41126-419bbe6.ngbuilds.io/. |
|
Note: this change should land after #41146. |
This commit makes the `FormBuilder` class tree-shakable by adding the `providedIn` property to its `@Injectable` decorator. Now if the `FormBuilder` class is not referenced in application's code, it should not be included into its production bundle.
419bbe6 to
69a0c78
Compare
|
You can preview d35d95a at https://pr41126-d35d95a.ngbuilds.io/. |
This commit makes the `RadioControlRegistry` class tree-shakable by adding the `providedIn` property to its `@Injectable` decorator. Now if the radio buttons are not used in the app (thus no `RadioControlValueAccessor` directive is initialized), the `RadioControlRegistry` should not be included into application's prod bundle.
d35d95a to
d0d2d59
Compare
|
You can preview d0d2d59 at https://pr41126-d0d2d59.ngbuilds.io/. |
| }, | ||
| { | ||
| "name": "RadioControlRegistry" | ||
| "name": "RadioControlRegistryModule" |
There was a problem hiding this comment.
Note to reviewers: this change indicates that the RadioControlRegistry was tree-shaken away, but the RadioControlRegistryModule shows up here as it's used as the providedIn value (see below). Note: the FormBuilder class is not showing up here since it's used in that demo app (forms_reactive) and the forms_template_driven golden file never contained it. I've verified that both symbols are not present in a simple app that don't use radio buttons and doesn't reference FormsBuilder directly.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR makes the
FormBuilderandRadioControlRegistryclasses tree-shakable by adding theprovidedInproperty to corresponding@Injectabledecorators and excluding these classes from NgModule definitions.Note: this improvement is a part of #41011.
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?