Description
While having the plotly bundle be deduplicated between this and other extensions (#1891) would help some of the issues users are seeing, the fact still remains that, minified or unminified, the plotly bundle is enormous: even minified, it's 4mb size is close to the entire minified lab bundle (5.5mb, last i checked).
Not familiar with this code base and whichever other ones use the plotly bundle, the example for another heavy widget #1891 (comment) would at least get the bundle out of the critical path. It is likely worth investigating if there is a way to do it at a finer-grained level (e.g. just plotly itself) but then the additional points of asynchrony might need to be found.
As suggested in #1891 (comment), lazy loading the bundle would provide several benefits to end users:
- less up-front time waiting for the "moons" animation for all users
- less CPU used during a local webpack rebuild for those that aren't using hosted/pre-built lab applications
The only downside is there would be a (potentially noticeable on slower connections) delay when the first widget is requested.