-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WebRTC replication plugin throw error in vite env #5841
Comments
I'm not trying to rule out an issue here, but as a data point I'm using the WebRTC replication with vite as a build tool without problems. Currently using rxdb 15.6.0 and vite 5.2.2 |
Seems to come from RxDB and not from simple-peer. Can you enable source maps? |
I tried to reproduce this problem in a new project ("vite": "^5.2.6", "rxdb": "^15.16.0"). https://www.npmjs.com/package/readable-stream#usage-in-browsers The version used in simple-peer is ^3.6.0 (https://github.com/feross/simple-peer/blob/f1a492d1999ce727fa87193ebdea20ac89c1fc6d/package.json#L20) My thoughts: The problem may be caused by vite not configuring polyfill by default or using the wrong polyfill when building the simple-peer, and there is a problem when building (warning in the console). If we use simplepeer-min.js directly, which is a built product with polyfill inside, we don't have this problem. On the whole, Problem solution:
|
I think it's a matter of polyfill when building, you can try this: https://stackblitz.com/edit/vitejs-rxdb-replication-webrtc?file=src%2Fdb%2Fplugins%2Freplication-webrtc%2Fconnection-handler-simple-peer.ts |
I merged your PR, release will come in the next days. |
Please reopen if still broken in the latest version. |
code:
error:

The text was updated successfully, but these errors were encountered: