-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Bundle external JS dependencies for custom models #1651
Conversation
I think at this stage of the project it is a good idea. That said, I think we should decide on a size limit and put it in the tests...e.g a 15MB limit for now and fail if we grow past that. Whether automated or not, I think we need to keep an eye on the total size to make sure it doesn't explode. Of course, when it makes sense things should be split up into separate packages/extensions... |
Codecov Report
@@ Coverage Diff @@
## master #1651 +/- ##
==========================================
- Coverage 85.41% 85.10% -0.31%
==========================================
Files 148 148
Lines 16840 16944 +104
==========================================
+ Hits 14384 14421 +37
- Misses 2456 2523 +67
Continue to review full report at Codecov.
|
So this will not work for all external dependencies, in particular if a dependency expects other files to be present alongside the main js/css files. As an example katex expects various woff font files to be present. So for now I'd only enable this for a subset of models. |
During build time this PR would pull all external resources specified on
Model.__javascript__
definitions and bundle them into thedist
folder, which means whenresources='server'
they could be served locally.The downside to this approach is that this grows the Python distribution by about 9 MB and this is only set to grow as more models are added. However this is the only approach that will allow these models to work in an air-gapped environment.
__javascript__
dynamically depending on the current resources setting@mattpap @MarcSkovMadsen @jbednar @xavArtley Opinions welcome here