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.
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.
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 likebraceandmathjscan 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