-
Notifications
You must be signed in to change notification settings - Fork 134
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
Introduce code-splitting to web app #81
Comments
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? |
Still relevant - looking for input! 😄 |
I’d say it depends on how much complexity is added to the project. I agree that 1.43 MB is a lot but maybe there are other ways to reduce the size, and maybe it’s not a problem for users of smee.io as it’s mostly developers |
That's a good point. This would definitely be a for-fun thing for me to help improve bundle sizes / performance, but I agree that it is likely not mission critical in the same way small bundle sizes would be for other applications. Happy to PR a before and after by introducing code splitting to get a sense of the tradeoff between complexity and bundle size improvements for others to take a look. 😄 |
If it’s for excercise, then by all means, send pull requests, just please don’t be mad if we don’t accept it because our main objective is to keep the project easy to maintain, it's only a side project. I say "we" but I don’t want to take any credit, I didn’t build any of this, just helping out myself :) |
Most definitely, no offense, just looking to engage in open source projects that I use / enjoy and see what I can help with from both practical and nice-to-have standpoints. ❤️ |
I echo this. I welcome the improvement, but don't know enough about what kind of maintenance issues this might introduce, and it's not clear if code-splitting would really save us a whole lot here. i wonder if the bigger savings would come from cutting down the overall bundle size (tree-shaking, minification, removing dependencies, etc.) and seeing if it's an acceptable size after that? |
I'm a little sad about that I ran this through You can see that a lot of the size comes from I've opened up #86 to tackle those fixes! |
I think a lot of the underlying problems of this have been addressed in #86, and if there are further improvements to lowering bundle size, let's open them up in separate issues. Closing this one. ❤️ |
Right now, running
npm run build
in theserver/
project generates onemain.min.js
bundle weighing in at 1.43 MB.If some code-splitting refactors are introduced, that could reduce the overall bundle size (a potential performance improvement). Some thoughts on how this could be introduced / places to look at code-splitting:
The first step would be adding support for the dynamic
import()
function to Babel using@babel/plugin-syntax-dynamic-import
for supporting dynamic imports being compiled by Webpack + Babel (my understanding is that Webpack usesimport()
statements as code split points).I've found
react-loadable
a helpful library for defining code split points for React components, as you can change the way you import the component but continue to render it the same way and benefit from code splitting.I think a good first component to code split out could either be
<ListItem>
or the default import fromreact-json-view
, since that component is not visible until a user expands the list item to view payload data. bundlephobia reports that react-json-view is 36.1kB minified and gzipped, so reducing that size from the initial bundle would likely improve load/parse times.Some other places where code-splitting could be worth investigating to see if there are potential bundle size wins:
<EventIcon>
's icon map. I'm guessing the icons are pretty small, but maybe loading them only when they are needed or at some point after the initial bundle has been downloaded could be a minor performance improvement?https://github.com/probot/smee/blob/79cfefe731d23b68abed09ca7d67daa37897f628/server/src/components/EventIcon.js#L24-L46
One open question would be around react-loadable's loading component and what that would look like in the context of where different app components are being loaded dynamically, but I'm probably getting ahead of myself of that one. 😅
Would you be interested in pull requests to help with this enhancement? Any thoughts around this?
The text was updated successfully, but these errors were encountered: