-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
worker support #1320
Comments
|
We use the method describe in those docs but that is also broken with |
Rspack currently not support web-worker or worker-loader, but we will work on supporting them later. |
@beaucollins that method doesn't work on Firefox because there's no ESM support for Web Workers yet. Bundling is the only reliable way to make web workers work across browsers. |
@thecodrr webpack replaces the |
Looks like #2340 will solve this for us. I'll report back. |
Look like #2340 can't resolve the web worker as the same with webpack 5: |
I can confirm that we can successfully use our worker code using And yes, @thecodrr this also works in Firefox since the bundle output does not actually use ESM. |
I'm not sure what I'm doing differently. With the following code using rspack 0.1.7, I get the TS file simply copied, untransformed (but renamed), to the output directory: const dbWorker = new Worker(
/* webpackChunkName: 'db-worker' */
new URL('../db-worker/db-worker.ts', import.meta.url)
); |
@birtles it seems I spoke too soon. The builds work but the Worker based feature is not. |
I've the same issue as @birtles has, I would expect that a new entry will be added (with the path of the |
a gentle follow-up, do we have an approx ETA for this fix? |
Do we have a patch/ experimental branch for this fix I can try ? |
it is not supported now, we will support it soon |
so if there is a milestone? this is a important feature for many complex system |
I'm working on it, will support it in the next one or two weeks |
@ahabhgk I've tested // some code
highlightWorker = new Worker(
new URL('./worker.ts', import.meta.url)
); // worker.ts
import config from './config'; // this file is not bundled inside the chunk that was created for worker.ts
console.log(config) |
@felixmosh Is there any runtime error? Could you provide a reproduction so I can dig into this |
@ahabhgk this is weird, with the rspack starter, it works properly. You can try this branch: https://github.com/felixmosh/bull-board/tree/ui-with-rspack
make sure you have radis running on a default port (via Docker or other) |
Love seeing worker support landing. |
@felixmosh Could you try 0.2.5-canary-7886e38-20230706011015, I believe it have been fixed by #3703 |
We have completed the basic support for web worker in v0.2.6, enough to cover most common cases, you can checkout our document for more detail But there are some uncommon cases we still not able to cover for now:
Since these issue are blocked by the implementation of compile time evaluation and parser hooks in Rspack, so I decide to close this one and tracking these in their own issue, if you have any problem when using worker with Rspack, feel free to open a new issue and ping me. |
Worker
The text was updated successfully, but these errors were encountered: