The requested module '@socket.io/component-emitter' does not provide an export named 'Emitter' #4210
-
I know the title sounds confusing, and I'll try my best to explain the issue. So I created a next.js app, and installed socket.io-client. When I try to import socket.io-client, I get an error.
I literally don't have any idea why this happens. I've used socket.io with create-react-app and never ran into this issue. I've tried using older versions, like [email protected] and more. But every time, I get the exact same error. I'm not even emitting events, or listening for an event, just importing socket.io-client. I'm new to next.js, and it's entirely possible that I'm doing something wrong. Should I try to include the bundle from a CDN, or are there any solutions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
That's weird, the named export is here: https://github.com/socketio/emitter/blob/cd703fe28e5bf85ecf137b0e6422e2608c0eefbf/index.js#L6 Could you please provide a complete example reproducing the issue? |
Beta Was this translation helpful? Give feedback.
-
Hello Switching socket.io-client to version 4.0 solves the problem, but it's not the way to go. Also this bug only occurs on expo web, but not on expo android emulation. Hope it helped somebody. |
Beta Was this translation helpful? Give feedback.
That's weird, the named export is here: https://github.com/socketio/emitter/blob/cd703fe28e5bf85ecf137b0e6422e2608c0eefbf/index.js#L6
Could you please provide a complete example reproducing the issue?