-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): make the error messages tree shakable #44219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramthir thanks for creating this PR 👍 The changes look good, I've just added a couple comments.
I've also noticed that the CI is failing and the error message indicates the positive impact of this change: bundles for the test apps decreased, see this CI job output:
FAIL: Commit undefined uncompressed main fell below
expected size by 500 bytes or >1% (expected: 139282, actual: 138491).
So this change helped reduce the bundle size by ~800 bytes (which is great!). Could you please take a look at the failing CI jobs and update payload size limits according to the actual bundle sizes, mentioned in the CI output? Please let me know if any additional information is needed on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramthir thanks for resolving merge conflicts! We've discussed this PR with the team and I've left a couple comments with some feedback. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramthir thanks for updating the PR, the changes look very good and we are very close. I've just added a couple more comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for applying the necessary updates @ramthir 👍
The changes look good and I've also rebased the PR (the setup
CI job was failing). We'll need to get one more review on this PR and run extra tests in Google's codebase (I will take care of this). I will keep you updated on how it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: size-tracking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: size-tracking
@ramthir it looks like the test
CI job is failing with size-related reasons:
FAIL: Commit undefined uncompressed main fell below expected size
by 500 bytes or >1% (expected: 237238, actual: 230506).
Could you please update the golden as I mentioned in the comment below?
Long error messages can be tree-shaken in the production build. Doing this, we will keep the throw and remove the long error messages. See: #44210 (review)
One more run of tests in Google's codebase (internal-only link). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed-for: size-tracking
@AndrewKushnir The presubmit you ran has one new failure (a hume target) -- have you looked at that at all? It seems to be unrelated to this change so it's likely a flake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🍪
reviewed-for: size-tracking
throw new Error( | ||
'There can be only one platform. Destroy the previous one to create a new one.'); | ||
const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? | ||
'There can be only one platform. Destroy the previous one to create a new one.' : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't write this line, but I hope whomever did write it initially was referencing Highlander.
@dylhunn yeah, that was a flake, I've restarted that test and everything is now fully "green" and this PR is ready for merge. |
This PR was merged into the repository by commit 96dfc7a. |
Long error messages can be tree-shaken in the production build. Doing this, we will keep the throw and remove the long error messages. See: #44210 (review) PR Close #44219
@ramthir thanks for contributing to Angular, this change will have a positive impact on all Angular applications (the If you are interested in creating more PRs, there are some other places that would benefit from a similar change, for example:
Also a few places in the following files (search for
I'm also exploring a possible solution to make the |
Thanks a lot, @AndrewKushnir; I'll look up and raise PRs on them. |
Long error messages can be tree-shaken in the production build. Doing this, we will keep the throw and remove the long error messages. See: angular#44210 (review) PR Close angular#44219
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. |
Long error messages can be tree-shaken in the production build.
Doing this, we will keep the throw and remove the long error messages.
See: #44210 (review)
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?
Long error messages are not tree-shakable in the production build.
Issue Number: N/A
What is the new behavior?
Long error messages are made tree-shakable in the production build based on the suggestion by @AndrewKushnir in PR 44210.
For constancy, I've done this change on all the error messages in
application_ref.ts
. @AndrewKushnir, please check if it's necessary.Does this PR introduce a breaking change?
Other information