Skip to content

[Bug]: Using the same web worker script from two different entry points triggers a Runtime error in dev #9902

@jraoult

Description

@jraoult

Version

System:
OS: macOS 15.4
CPU: (8) arm64 Apple M3
Memory: 89.36 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
Yarn: 4.8.1 - ~/.nvm/versions/node/v22.14.0/bin/yarn
npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
Browsers:
Brave Browser: 134.1.76.82

Details

I have two entry points (app and report), and both endpoints instantiate a web worker executing the same script. In dev mode, I get the following runtime error:

src_common_worker_ts.js:168 Uncaught SyntaxError: Invalid or unexpected token (at src_common_worker_ts.js:168:20)

and this is what the culprit snippet looks like in the src_common_worker_ts.js file:

// webpack/runtime/get_main_filename/update manifest
(() => {
__webpack_require__.hmrF = function () {
            return "app
c0291249ad859a04." + __webpack_require__.h() + ".hot-update.json";
         };
        
})();

I suspect the issue is the new line after the app prefix, but I don't understand why this condition triggers it.

Reproduce link

https://github.com/user-attachments/files/19571728/repro-rsbuild-worker-issue.zip

Reproduce Steps

Download and unzip the reproduction project repro-rsbuild-worker-issue.zip

Inside the root folder run:

nvm use
yarn
yarn workspace @tsx-sandbox/main dev

Then, access either of the entry points and open the browser console to see the error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions