-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Using MessageChannel
pulls in undici
inappropriately
#57581
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
Comments
cc @nodejs/undici I think also typescript has the same issue since amaro lazy loads a wasm |
MessageEvent is part of the HTML standard and it's at basis of WebSocket. https://html.spec.whatwg.org/multipage/comms.html That's why the global comes from undici. What I'm a bit puzzled about is why for non-spec compliant objects we are using it in node/lib/internal/worker/io.js Line 94 in c3b6f94
This appears to come from #52370. Wdyt @KhafraDev? |
It was exposed globally where the real issue arose from, when |
The only place where MessageEvent is mentioned in our docs is https://nodejs.org/api/worker_threads.html#broadcastchannelonmessage. I'm a bit puzzled why we use it here to begin with. @jasnell @addaleax do you recall? |
Puzzled about using it where exactly? |
About why our I think we can add a fallback if there is no fetch/undici for |
well, |
Version
v22.13.1
Platform
Subsystem
worker_threads
What steps will reproduce the bug?
Run this command:
node --jitless -e 'const { port1, port2 } = new MessageChannel(); port1.addEventListener("message", () => {}); port2.postMessage(null);'
or run this script with
--jitless
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
No exception should be thrown,
undici
should not be loaded when fetch is not needed.What do you see instead?
Additional information
I believe this is due to constructing the
MessageEvent
, which appears to come fromundici
:node/lib/internal/worker/io.js
Line 98 in 4006d5e
The text was updated successfully, but these errors were encountered: