-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
build: optimize webpack code split #10831
Conversation
a8275c8
to
c17350b
Compare
Thanks for the work in this space! Was the main focus here only on dashboards, or do we expect to see more optimal webpack bundling across all pages in the app? |
I think another low-hanging fruit is to make |
Yeah |
'jquery', | ||
'core-js.*', | ||
'@emotion.*', | ||
'd3.*', |
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.
this may also pull the one-time-use packages (that are not part of core d3) such as d3-sankey
d3-cloud
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'll make further tuning in this space in future PRs.
Follow up on #10831, move brace and mathjs to async modules so that the initial page load for dashboards most pages can be faster.
Follow up on apache#10831, move brace and mathjs to async modules so that the initial page load for dashboards most pages can be faster.
SUMMARY
Give more hints to webpack code split so that vendor scripts can be better extracted and cached. Reduced the overall bundle size from 7.05MB to 4.11MB.
Future plan would be to utilize more async module imports
import(...)
so that large chunks of code likebrace
andmathjs
can be loaded on demand instead of on page load.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
Bundle sizes via
npm run build -- --analyzeBundle=true
:Visiting an example dashboard ("Tabbed Dashboard" from example testing data) with throttled network:
After
There are more JavaScript requests, but DOMContentLoaded time improved. Note this is also only the initial visit. We expect average load time to improve for future new releases as vendor scripts now have better cache.
TEST PLAN
Make sure CI passes.
ADDITIONAL INFORMATION