You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/
Describe the bug
When using WebsocketProvider in a node script, y-websocket.js and lib0 reference window, making the script crash respectively with:
ReferenceError: window is not defined
at new WebsocketProvider (/.../node_modules/y-websocket/dist/y-websocket.cjs:267:5)
ReferenceError: addEventListener is not defined
at new LocalStoragePolyfill (node_modules/lib0/dist/broadcastchannel-49d2cc56.cjs:30:5)
at node_modules/lib0/dist/broadcastchannel-49d2cc56.cjs:51:16
at Object.setIfUndefined (node_modules/lib0/dist/map-28a001c9.cjs:51:24)
at getChannel (node_modules/lib0/dist/broadcastchannel-49d2cc56.cjs:49:7)
at Object.subscribe (node_modules/lib0/dist/broadcastchannel-49d2cc56.cjs:68:32)
at WebsocketProvider.connectBc (node_modules/y-websocket/dist/y-websocket.cjs:311:10)
at WebsocketProvider.connect (node_modules/y-websocket/dist/y-websocket.cjs:362:12)
at new WebsocketProvider (node_modules/y-websocket/dist/y-websocket.cjs:279:12)
Checklist
Describe the bug
When using
WebsocketProvider
in a node script,y-websocket.js
andlib0
referencewindow
, making the script crash respectively with:To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error.
Environment Information
Additional context
This code successfully works around the issue:
The text was updated successfully, but these errors were encountered: