I am trying to use the library with React and Next npx create-next-app@latest
and I get
Failed to compile
./app/page.tsx:2:0
Module not found: Default condition should be last one
1 | import Image from "next/image";
> 2 | import { RTCPeerConnection } from 'werift';
3 |
4 | export default function Home() {
5 | const pc = new RTCPeerConnection({});
https://nextjs.org/docs/messages/module-not-found
After some digging around I found a solution that worked for me.
I went into the node_modules/werift/pacκage.json and changed the order of the exports like this
"exports": {
".": {
"types": "./lib/webrtc/src/index.d.ts", <------ Moved types first.
"default": "./lib/webrtc/src/index.js" <------ Default second.
},
"./nonstandard": {
"types": "./lib/webrtc/src/nonstandard/index.d.ts", <----- Same for non standard exports.
"default": "./lib/webrtc/src/nonstandard/index.js"
}
},
and it seems to work. I am quite novice with typecript, I don't know if this happens to anyone else but I leave it here for others who may face the same issue.
(feel free to close the ticket if you deem staying open doesn't help anyone)
Hello,
I am trying to use the library with React and Next
npx create-next-app@latest
and I get
After some digging around I found a solution that worked for me. I went into the
node_modules/werift/pacκage.json
and changed the order of the exports like thisand it seems to work. I am quite novice with typecript, I don't know if this happens to anyone else but I leave it here for others who may face the same issue.
(feel free to close the ticket if you deem staying open doesn't help anyone)