-
-
Notifications
You must be signed in to change notification settings - Fork 135
enhance: add dynamic import for stack trace decoding in error boundary. #2667
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
base: master
Are you sure you want to change the base?
enhance: add dynamic import for stack trace decoding in error boundary. #2667
Conversation
|
This is an amazing find! It actually works great. I’ll test the difference in bundle size in a fake-production environment and get back to you. |
Soxasora
left a comment
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.
components/error-boundary.js
Outdated
| return <Button className='mt-3' onClick={onClick}>copy error information</Button> | ||
| return ( | ||
| <Button className='mt-3' onClick={onClick} disabled={copying}> | ||
| {copying ? 'copying...' : 'copy error information'} |
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.
while this is nice to look at, the toaster already does the job of giving visual feedback, so this is unnecessary.
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.
Fair, removed.
Actually, would be cool to know how you do your fake prod environment if you don't mind with a quick overview of what you skip/include. |
|
In this particular case there was no need to run a full production environment. So I just used |
|
Ahh fair, considered using bundle analyzer too but wasn't too sure on what metric to use to measure the savings between the parsed/gzipped for the client. That's why I used the first load reporting next has for its builds. |


Description
Addresses #1832
Reducing bundle size by importing
decodeMinifiedStackTracewhen copy error button is actually clicked. Rare user path so should have minimal impact. Noticed in a different project so figured I could bring it here and looks like it has significant bundle savings.Screenshots
Before fix:


After fix:
From 1.01MB -> 917kB, which is about 10%
For testing the functionality I added a window function to force an error in
ErrorBoundaryconstructor method:Vid:
Screen.Recording.2025-12-04.at.17.16.46.mov
Checklist
Are your changes backward compatible? Please answer below:
For example, a change is not backward compatible if you removed a GraphQL field or dropped a database column.
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
9
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
Did you introduce any new environment variables? If so, call them out explicitly here:
N
Did you use AI for this? If so, how much did it assist you?
Y, coming up with a way to test that wasn't too hacky.