perf(forms): use ngDevMode to tree-shake error messages
#37821
Conversation
7af7f75
to
94af248
ngDevMode to tree-shake error messages
|
FYI, I just did a quick test with a demo app and ReactiveForms module. The We should consider creating a test app with all Forms features (Reactive, Template-driven, validators, etc) in the |
Thanks for these changes @sonukapoor, as I mentioned in my previous comment in the thread, it helps save around 7kb (or ~20%).
I've left a few comments, mainly around additional refactoring that can be made to avoid having noop functions (when the whole body of the function is guarded with ngDevMode check).
Another thing that we should consider is to make sure this works correctly with View Engine (since ngDevMode was mostly used in Ivy runtime code).
Thank you.
packages/forms/src/directives/reactive_directives/form_control_directive.ts
Outdated
Show resolved
Hide resolved
2e0cd30
to
cb7cbdf
d83aee6
to
2108d7a
packages/forms/src/directives/reactive_directives/form_control_directive.ts
Outdated
Show resolved
Hide resolved
ded1da7
to
c6ec06b
|
Hi @sonukapoor, thanks for performing further updates! That's really great to see the dev-mode-only symbols go from the golden file |
c6ec06b
to
778b820
LGTM
Reviewed-for: public-api
|
By using the example forms code found here in combination with a newly generated CLI application, a savings of ~7kb was observed for both View Engine and Ivy renderers. One area that might be beneficial to investigate is to potentially change the View Engine startup process to guarantee that |
6d85f17
to
61e2a22
…es in prod builds This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes angular#37697
ngDevMode to tree-shake error messagesngDevMode to tree-shake error messages
61e2a22
to
662af03
|
FYI, tests in Google's codebase (global presubmit) went well. Also adding a link to similar changes in Components repo for visibility: angular/components#20146. |
…es in prod builds (angular#37821) This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes angular#37697 PR Close angular#37821
…r messages in prod builds (angular#37821)" This reverts commit e8c96da.
…es in prod builds (angular#37821) This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes angular#37697 PR Close angular#37821
…es in prod builds (angular#37821) This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes angular#37697 PR Close angular#37821
|
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. |


PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #37697
What is the new behavior?
Does this PR introduce a breaking change?
Other information
The text was updated successfully, but these errors were encountered: