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

[Bug]: Getting "should have __webpack_require__.f.consumes" error with module federation enabled #7417

Open
hverlin opened this issue Aug 2, 2024 · 7 comments
Assignees
Labels
bug Something isn't working stale

Comments

@hverlin
Copy link
Contributor

hverlin commented Aug 2, 2024

System Info

Using 1.0.1-beta.9 (but visible on earlier versions as well).

Details

With module federation 1.5 (using https://rsbuild.dev/config/module-federation/options), I am getting the following error:

Uncaught Error: should have __webpack_require__.f.consumes
    at __webpack_require__.f.consumes (_define_property.js:8:1)
    at _define_property.js:8:1
    at Array.reduce (<anonymous>)
    at __webpack_require__.e (_define_property.js:8:1)
    at Array.map (<anonymous>)
    at __webpack_require__.x (_define_property.js:8:1)
    at _define_property.js:8:1
    at _define_property.js:8:1

(seems similar to #6773)

Reproduce Steps

I think this is related to web-workers. In my code, I think that it's failing because of this line.

import { wrap } from 'comlink';
...
const w = wrap(new Worker(new URL('workers/worker.js', import.meta.url)));

If I inline the web-worker in my code, the error goes away. This not a good workaround, however, as the performance of the application will suffer.

@hverlin hverlin added bug Something isn't working pending triage The issue/PR is currently untouched. labels Aug 2, 2024
@dungnguyenBKA
Copy link

dungnguyenBKA commented Aug 27, 2024

I also faced this bug. My application have 1 worker and this bug occurred. When I comment out worker lines then app start working. Is that any update on how to fix that temporary @hverlin ?

@hverlin
Copy link
Contributor Author

hverlin commented Aug 29, 2024

I did not find a way around this issue so far.

@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Sep 2, 2024
Copy link

stale bot commented Nov 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Nov 1, 2024
@hverlin
Copy link
Contributor Author

hverlin commented Nov 1, 2024

bump

@chebotaevroman
Copy link

bump

workaround: use - ModuleFederationPluginV1

@stale stale bot removed the stale label Dec 20, 2024
Copy link

stale bot commented Feb 18, 2025

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Feb 18, 2025
@hverlin
Copy link
Contributor Author

hverlin commented Feb 18, 2025

I can still reproduce in my project with the latest rsbuild version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

5 participants