Giter Site home page Giter Site logo

Comments (6)

pubkey avatar pubkey commented on May 19, 2024 1

Please reopen if still broken in the latest version.

from rxdb.

cleech avatar cleech commented on May 19, 2024

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

from rxdb.

pubkey avatar pubkey commented on May 19, 2024

Seems to come from RxDB and not from simple-peer. Can you enable source maps?

from rxdb.

croatialu avatar croatialu commented on May 19, 2024

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

https://stackblitz.com/edit/vitejs-rxdb-replication-webrtc?file=src%2Fdb%2Fplugins%2Freplication-webrtc%2Fconnection-handler-simple-peer.ts

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:

  1. The polyfill of the vite configuration module, such as readable-stream, etc. (What if I used a different build tool?)
  2. Directly use simplepeer-min.js with polyfill. (https://github.com/feross/simple-peer/blob/f1a492d1999ce727fa87193ebdea20ac89c1fc6d/package.json#L63)

from rxdb.

croatialu avatar croatialu commented on May 19, 2024

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

from rxdb.

pubkey avatar pubkey commented on May 19, 2024

I merged your PR, release will come in the next days.

from rxdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.