Try lazy-loading widgets in Lab#1192
Conversation
|
Jlab automatically deduplicates threejs if the versions overlap. That's part of the big reason for the build step. |
|
great, that's progress, but still built into |
|
Just because i looked: So, hooray 🎉! |
|
Here's the situation as of 8b1935e: I don't actually know where threejs went, as I can't see it in stats, but it's working fine: |
|
Of additional concern is the extra copy of |
Perhaps it was split out to a different file now? Those choices are made automatically at build time, so adding an extension may lead to some different division. The extension system rework in jlab 3 leads to more things being split out (and shared)
There shouldn't be two copies of lumino widgets, as far as I know, so I think that is indeed a cause for concern. |
|
> I don't actually know where threejs went
Perhaps it was split out to a different file now?
Yeah I'll do some more debugging... I also intend to pull in the other
threejs consumers and see what happens!
The extension system rework in jlab 3 leads to more things being split out
(and shared)
Oh I know, that work has been epic, and will be really good for users,
admins, and downstreams. As a dev, am awaiting the right time to start
putting some aggressive against master! But I'll be supporting stuff on lab
1 and 2 well into next year, no doubt. 😿
>Of additional concern is the extra copy of @lumino/widgets... but I assume
> there's a good, known reason for it.
There shouldn't be two copies of lumino widgets, as far as I know, so I
think that is indeed a cause for concern.
Welp, it's using the phosphor alias thingy, and it's pulling the older
dist, rather than the es6... But would have to dig some more.
_edit: quotations_
|
|
On the duplicate widgets: that was already appearing in the downstream where i found the issue, but the two copies appeared in For reference, a vanilla build only includes the index.es6.js |
|
I tried a couple alternate import mechanisms to get at the "real" MessageLoop/Widget, and it's always still pulling its own copy in. While I think it would be possible to get at the Widget class from some part of anyhow: approaches tried
|
|
Yeah, fiddled with some other stuff, no change. I don't think it can be solved from this side, short of changing the phosphumino dependency, which i assume is done to avoid having to maintain separate releases. I'm not entirely sure it's worth fixing this in Lab2 if it hasn't actually been creating problems... |
| exports: bqplot, | ||
| name, | ||
| version, | ||
| exports: async () => import('./index'), |
There was a problem hiding this comment.
Is this the key feature of this PR? (thinking about doing the same in other widgets lib)
There was a problem hiding this comment.
yep, this is the key thing.
|
Yeah that's the feature, and _requires_ the "module: esnext" setting over
in tsconfig. To get at the package.json from a .ts, with "composite: true"
needed the extra tsconfig jiggery pokery.
|
|
Have repushed with various updates: it builds/runs locally on Ubuntu, and the tests pass on chromium 98. guess i'd like to see what CI says before sinking any more time! |
|
Thanks @bollwyvl, just approved the CI |
|
@martinRenou thanks! it's pleasing it worked right off the bat. I really don't think anything in there constitutes an even noticeable change to downstreams, but certainly welcome feedback. I'll have a look at some of those other ones! |
|
Thanks!! |




This uses the approach from pythreejs to defer loading the widgets until one is actually requested, which should shave nearly 30% off of the built lab. Because threejs is so large, it may also be worth deferring that, too, if possible, as it doesn't appear its usage is guaranteed if someone is using one of the simpler plots.
better still would be to arrive at a common, compatible packaging of threejs, which could be shared by all consumers (e.g.
pythreejs,bqplot,ipyvolume) but I have no idea what the compatibility windows are like for all of them.2021-06: sorry i let this slide for so long. I've rejiggered a few things to make working with
package.jsona bit more up-to-date with typescript conventions (weird as they are) with thecompositebuild. Would love to see this land to get release along with #1379.It's probably worth taking a hard look at the
sharedPackages(e.g.three.js,underscore) as every extra copy of those heavies we don't have to loadntimes in e.g. jupyterlite makes me 😀