The requested module 'socket.io' does not provide an export named 'default' after upgrade to 3.0
See original GitHub issueNote: for support questions, please use one of these channels: stackoverflow or slack
For bug reports and feature requests for the Swift client, please open an issue there.
For bug reports and feature requests for the Java client, please open an issue there.
You want to:
- report a bug
- request a feature
Current behaviour
What is actually happening?
import SocketIO from "socket.io";
export const io = SocketIO(server, {
pingInterval: 10000,
pingTimeout: 5000,
});
Then i get an error in console:
import SocketIO from "socket.io";
^^^^^^^^
SyntaxError: The requested module 'socket.io' does not provide an export named 'default'
Steps to reproduce (if the current behaviour is a bug)
- Install socket.io 3.0 and node 15.0.1
- Enable type: “module” and --es-module-specifier-resolution=node
- Get error
Note: the best way (and by that we mean the only way) to get a quick answer is to provide a failing test case by forking the following fiddle.
Expected behaviour
Importing and running like before
What is expected?
Setup
- OS: Mac os Catalina
- browser: no browser
- socket.io version: 3.0
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to import socket.io npm packege - Nodejs - Stack Overflow
There are two kinds of exports: named exports (several per module) and default exports (one per module). It is possible to use both...
Read more >Migrating from 2.x to 3.0 - Socket.IO
A v3 client is still not be able to connect to a v2 server though. ... to the default namespace ( / ),...
Read more >Requested module does not provide export named 'default'
To solve the error "The requested module does not provide an export named 'default' ...
Read more >socket.io-client - npm
Start using socket.io-client in your project by running `npm i socket.io-client`. There are 7127 other projects in the npm registry using ...
Read more >the requested module 'vue' does not provide an export named ...
The thing you want to do is import vue but it doesnot have a default export function or either the default thing to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re right, this part was missing from the migration guide, sorry for that.
Server:
Client:
I got it working with
import {Server, Socket} from 'socket.io'; const io = new Server(server);
But after it: be aware to update the client-side to 3.0.0 too! https://github.com/socketio/socket.io-client