Closed croatialu closed 6 months ago
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'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
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 In the readable-stream introduction, "Polyfills are no longer required since version 4.2.0."
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, Cause of the problem: Some modules used in "simple-peer" lack corresponding polyfill or have problems with polyfill when vite is built. Causing vite to issue a warning.
Problem solution:
Seems to come from RxDB and not from simple-peer. Can you enable source maps?
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: