-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
jupyter-ai slows down initial page load significantly by downloading 4MB of icons it does not need #1221
Comments
There is 16 icons from jupyter-ai/packages/jupyter-ai/src/slash-autocompletion.tsx Lines 5 to 14 in 4154733
jupyter-ai/packages/jupyter-ai/src/components/settings/existing-api-keys.tsx Lines 9 to 16 in 4154733
jupyter-ai/packages/jupyter-ai/src/components/chat-settings.tsx Lines 18 to 19 in 4154733
Half of these are already available in JupyterLab core (Download, Cancel, Edit, Settings, Check, Warning, Help). Using icons from core and adding SVG for icons which are not in core would probably be the best for performance. In any case we do not need to fetch ~2200 icons. |
Also one can verify that this is issue in how jupyter-ai is compiled by downloading the source or wheel from https://pypi.org/project/jupyter-ai/2.29.0/#files and analyzing the size of the unpacked archive (yes, after compression it is smaller, but unpacked it is 6MB): |
The solution is to either configure tree-shaking (not sure what is wrong with webpack config here), or to use path imports instead of top-level imports, see:
Of note, I already put path imports in |
Ah, it seems like maybe nothing is wrong in config, webpack just does not shake with module federation, unless it is tricked into doing that with using a dummy shared package as described in: webpack/webpack#12532 |
Thanks for reporting this! I didn't know that Webpack doesn't tree shake when module federation is used. I think we need to first add a CI step that fails when importing from It's unlikely that I will find the time to dive deep into this. @krassowski Do you have any suggestions on how we can enforce path imports? |
I looked into some alternatives, like using So yes, probably using eslint to enforce path imports with |
Description
This is because of dependency on
@mui/icons-material
and lack of any control what of it gets included.Reproduce
Expected behavior
jupyter-ai
does not stall opening JupyterLab nor Jupyter NotebookContext
The text was updated successfully, but these errors were encountered: