-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Description of Bug
Calling new BroadcastChannel(name) inside a Node.js context in StackBlitz is causing the following error:
❯ node
Welcome to Node.js v20.19.0.
Type ".help" for more information.
> new BroadcastChannel('example')
Uncaught TypeError: Cannot read properties of undefined (reading 'on')
at _0x1c74ce.runInContext (https://vitejsviteviaqn3q5-a0bn.w-credentialless-staticblitz.com/blitz.fb22cd3d.js:31:883177)
at _0x1c74ce.runInThisContext (node:vm:322:1534)
at REPLServer.defaultEval (node:repl:303:7356)
at bound (node:domain:29:4669)
at REPLServer.runBound (node:domain:29:4696)
at REPLServer.onLine (node:repl:303:13910)
at REPLServer.emit (node:events:30:11150)
at REPLServer.emit (node:domain:29:5199)
at [_onLine].[as (node:internal/readline/interface:203:5329)
at [_line].[as (node:internal/readline/interface:203:10230)Steps to Reproduce
- Go to https://stackblitz.com/edit/vitejs-vite-viaqn3q5
- Run
nodein the terminal - Run
new BroadcastChannel('example') - See error
Expected Behavior
I expected that a new broadcast channel would be created. The error does not happen locally, even using the same Node.js version as StackBlitz (currently 20.19.0):
> node
Welcome to Node.js v20.19.0.
Type ".help" for more information.
> new BroadcastChannel('example')
BroadcastChannel { name: 'example', active: true }
