Skip to content

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

@hverlin

Description

@hverlin

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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions