dmotz / trystero

✨🤝✨ Build instant multiplayer webapps, no server required — Magic WebRTC matchmaking over BitTorrent, Nostr, MQTT, IPFS, Supabase, and Firebase
https://oxism.com/trystero
MIT License
1.14k stars 85 forks source link

module not found when using with next.js #76

Closed snimshchikov closed 1 month ago

snimshchikov commented 2 months ago

Next.js doesn't like the new version

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/webrtc-polyfill/index.js
./node_modules/@thaunknown/simple-peer/lite.js
./node_modules/@thaunknown/simple-peer/index.js
./node_modules/trystero/src/peer.js
./node_modules/trystero/src/strategy.js
./node_modules/trystero/src/nostr.js
./node_modules/trystero/src/index.js
./src/app/play/page.tsx
 ⨯ ./node_modules/webrtc-polyfill/lib/RTCPeerConnection.js:1:1
Module not found: Default condition should be last one
snimshchikov commented 2 months ago

note: I didn't try to use it outside next

snimshchikov commented 2 months ago

That's strange, internet suggests that this issue is related to exports order https://stackoverflow.com/questions/76127288/module-not-found-error-default-condition-should-be-last-one

But ThaUnknown's library seems to already have the correct order... https://github.com/ThaUnknown/webrtc-polyfill/blob/4b1a95a2a10f504e1aee5c88323d49b28dc0113c/package.json#L23

snimshchikov commented 1 month ago

Fixed in webrtc-polyfill 1.1.7