Skip to content
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

Switch from webpack to rspack for bundling #16005

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Mar 15, 2024

References

#15035

List of supported webpack plugins: https://www.rspack.dev/plugins/webpack/

Code changes

WARNING in ./node_modules/@jupyterlab/mathjax-extension/style/fonts.css
  ⚠ Module parse warning:
  ╰─▶   ⚠ css: Deprecated '~'
        │ '@import' or 'url()' with a request starts with '~' is deprecated.

User-facing changes

None

Backwards-incompatible changes

Should be none for most users and administrators using a stock JupyterLab with prebuilt extensions. Rspack supports module federation so existing extensions are compatible with JupyterLab built with Rspack and don't need to be updated.

Below is a screenshot showing JupyterLab running in dev mode from this branch, picking up the jupyterlab-execute-time prebuilt extension:

image

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@jtpio
Copy link
Member Author

jtpio commented Mar 15, 2024

Opening early to:

@jtpio
Copy link
Member Author

jtpio commented Mar 18, 2024

Some first numbers running jlpm build:dev:prod:release:

rspack

image

webpack

image

@erkin98
Copy link
Contributor

erkin98 commented Apr 2, 2024

Hi @jtpio , how to migrate custom widget library with custom webpack.config.js?

@jtpio
Copy link
Member Author

jtpio commented Apr 10, 2024

Rspack 0.6.0 now supports it: https://www.rspack.dev/blog/announcing-0.6.html#built-in-support-for-mini-css-extract-plugin

@FoSuCloud
Copy link
Contributor

@jtpio I want to join your work, should I continue contributing to the jupyterlab-rspack project?

@jtpio
Copy link
Member Author

jtpio commented Apr 15, 2024

Thanks @FoSuCloud!

https://github.com/jtpio/jupyterlab-rspack might be lagging a bit behind now. Maybe we could work on this PR directly instead? If you are able to open PRs against this branch I would be happy to merge your contributions.

There are still a few items listed in the top comment that we should check / re-enable, that can serve as a good starting point for continuing this work.

Thank you again for offering your help!

@jtpio
Copy link
Member Author

jtpio commented Apr 15, 2024

Hi @jtpio , how to migrate custom widget library with custom webpack.config.js?

@erkin98 for now this is not ready yet. But hopefully the custom webpack.config.js should still be compatible with Rspack (or we should make it possible to use the same config). Would you be able to share the config here or in #15035?

@jtpio
Copy link
Member Author

jtpio commented Apr 16, 2024

Looks like updating to the Rspack 0.6.1 release introduces the following error in the dev tools console:

image

@xc2
Copy link

xc2 commented Apr 16, 2024

Looks like updating to the Rspack 0.6.1 release introduces the following error in the dev tools console:

image

web-infra-dev/rspack#6230 this might be the same cause. Could you please try out the nightly version?


image

seems not help


image

the current nightly version 0.6.1-canary-73a9832-20240414004901 should help

@jtpio
Copy link
Member Author

jtpio commented Apr 17, 2024

Thanks @xc2 for chiming in!

Also updating to the latest 0.6.2 seems to be giving this issue:

../node_modules/@rspack/binding/binding.d.ts:36:47 - error TS2552: Cannot find name 'PathData'. Did you mean 'JsPathData'?
36   getAssetPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): string
                                                 ~~~~~~~~
../node_modules/@rspack/binding/binding.d.ts:37:55 - error TS2552: Cannot find name 'PathData'. Did you mean 'JsPathData'?
37   getAssetPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): PathWithInfo
                                                         ~~~~~~~~

@xc2
Copy link

xc2 commented Apr 17, 2024

Thanks @xc2 for chiming in!

Also updating to the latest 0.6.2 seems to be giving this issue:

../node_modules/@rspack/binding/binding.d.ts:36:47 - error TS2552: Cannot find name 'PathData'. Did you mean 'JsPathData'?
36   getAssetPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): string
                                                 ~~~~~~~~
../node_modules/@rspack/binding/binding.d.ts:37:55 - error TS2552: Cannot find name 'PathData'. Did you mean 'JsPathData'?
37   getAssetPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): PathWithInfo
                                                         ~~~~~~~~

Thanks!

@ahabhgk fixes it in web-infra-dev/rspack#6265

please try 0.6.2-canary-4b8f4a6-20240417094517

@jtpio
Copy link
Member Author

jtpio commented Apr 17, 2024

Thanks @xc2!

I tried forcing the resolution of @rspack/cli, @rspack/core and @rspack/binding to the 0.6.2-canary-4b8f4a6-20240417094517 canary release, but it looks like there is still the same issue happening.

@xc2
Copy link

xc2 commented Apr 17, 2024

Thanks @xc2!

I tried forcing the resolution of @rspack/cli, @rspack/core and @rspack/binding to the 0.6.2-canary-4b8f4a6-20240417094517 canary release, but it looks like there is still the same issue happening.

sry, a new PR is open for this

tested in jupyterlab codebase - at least the rspack building tasks are competed.

image

still waiting for the canary release finished


upd: 0.6.2-canary-9f58a91-20240417174925

@jtpio
Copy link
Member Author

jtpio commented Apr 17, 2024

This seems to be fixing it, thanks @xc2!

@jtpio
Copy link
Member Author

jtpio commented Apr 23, 2024

Status update: there seems to be only 3 failing CI checks remaining:

ERROR in × Conflict: Multiple assets emit different content to the same filename bundle.js
  • UI tests:
    • 3 failing checks in the documentation tests related to the Mathjax fonts not loaded correctly?
    • Main UI tests: 4 failing checks, also related to some CSS differences:
diff-mathjax-rspack.webm

image

rspack-failing-ui-tests.webm

There is also still some commented code related to the watch mode, and our use of license-webpack-plugin (listed in the top comment), still to be fixed.

@jtpio
Copy link
Member Author

jtpio commented Apr 23, 2024

@FoSuCloud I just posted a summary of where we currently are with the latest updates on this PR: #16005 (comment). In case you would still like to help with this, that would be really appreciated, thanks!

@FoSuCloud
Copy link
Contributor

@FoSuCloud I just posted a summary of where we currently are with the latest updates on this PR: #16005 (comment). In case you would still like to help with this, that would be really appreciated, thanks!

I would be happy to contribute to this, thank you very much for the invitation

@jtpio
Copy link
Member Author

jtpio commented May 1, 2024

Thanks @FoSuCloud! I rebased the PR to fix the conflicts.

@jtpio
Copy link
Member Author

jtpio commented May 7, 2024

Ah, 0.6.4 seems to be failing with the following error (in https://github.com/jupyterlab/jupyterlab/actions/runs/8987878993/job/24687416227?pr=16005):

Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
      Message:  index out of bounds: the len is 2 but the index is 2
      Location: crates/rspack_plugin_javascript/src/utils/eval/eval_tpl_expr.rs:44

      Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
      Run with RUST_BACKTRACE=full to include source snippets.

cc @xc2 who may know what the issue could be?

@chenjiahan
Copy link

@ahabhgk can you help to check this Rspack panic ❤️

@xc2
Copy link

xc2 commented May 8, 2024

Ah, 0.6.4 seems to be failing with the following error (in https://github.com/jupyterlab/jupyterlab/actions/runs/8987878993/job/24687416227?pr=16005):

Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
      Message:  index out of bounds: the len is 2 but the index is 2
      Location: crates/rspack_plugin_javascript/src/utils/eval/eval_tpl_expr.rs:44

      Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
      Run with RUST_BACKTRACE=full to include source snippets.

cc @xc2 who may know what the issue could be?

I have tested both versions 0.6.4 and 0.6.5, and found that the panic is gone in 0.6.5.

It should have been fixed in web-infra-dev/rspack#6473.

Btw, if you got type error regarding @rspack/core/dist/config/zod.d.ts with 0.6.5, please temporarily enable the skipLibCheck option in tsconfig.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants