-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
(fix) Improve code splitting and dependencies #1468
Conversation
This PR does two things: * It moves "shared" dependencies into the apps actual dependency list * It reworks how the appointments app does code splits to reduce the overall size of the app
9caba1f
to
1d0ceaa
Compare
Size Change: -824 kB (-10.5%) 👏 Total Size: 7.02 MB
ℹ️ View Unchanged
|
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.
Excellent! Thanks, @ibacher!
@ibacher what's the rule of the thumb now regarding Has this changed? Should we be using |
So this PR originated when I was playing around with caching and noticed the appointments app was downloading a 350kB chunk of code, which seemed large (most chunks are <50kB). When I ran the analyzer there were a few minor things (it was embedding react-dom and xlsx was probably larger than it needed to be), but I noticed that Carbon was being loaded in both the "main" chunk and the 350kB one. At its heart, that's what this is fixing. So my current approximation for a rule here is: don't load something that makes heavy use of Carbon synchronously, especially "heavier" components like data tables or other things where each component uses multiple sub-components). I'm also thinking that most apps shouldn't have more than 2-3 synchronously loaded components, since that seems to be where we wind up. Maybe that can be glossed as "just load things in the sidebar synchronously"? |
Yeah, thanks for the context. I ask because I'd gone on to file a separate PR inspired by this one, but I feel it goes too far in the other direction as we end up with approximately one or two max synchronously loaded components per app. Those are just dashboard links. Everything else is lazy-loaded. Does that sound too far off the mark? |
No that sounds about right. I think previously, I thought that front-loading as much of an app as we could would yield better performance, but I'm no longer sure that's the case (though it probably gets you better performance on initial load). |
Ok, here's the PR. |
Requirements
Summary
This PR does two things:
Screenshots
Related Issue
Other