Does not work with Vite.js and vue 3.
See original GitHub issueDescribe the bug The same code with webpack works. But Vite.js + Vue 3 is not. There is even no requests. Probably it’s not problem of socket.io-client package but something wrong with socket.io-client.
To Reproduce
Socket.IO server version: 4.2.0
Server
import { Server } from "socket.io";
const io = new Server(3000, {});
io.on("connection", (socket) => {
console.log(`connect ${socket.id}`);
socket.on("disconnect", () => {
console.log(`disconnect ${socket.id}`);
});
});
Socket.IO client version: 4.2.0
Client
import { io } from "socket.io-client";
const socket = io("ws://localhost:3000/", {});
socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});
socket.on("disconnect", () => {
console.log("disconnect");
});
Expected behavior Expected to see console.log messages on server and client. But it’s not working at all.
Platform:
- OS: [e.g. Windows 10]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Getting Started - Vite
Scaffolding Your First Vite Project Vite requires Node.js version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade ......
Read more >Vue 3 + vite works on development but not in production
js 3 and vite. When i run on development mode, it works fine. Then i built the website using yarn build and run...
Read more >Getting started with Vite and Vue 3 | Ninja Squad
The fun thing is that Vite is not tied to Vue: it can be used with Svelte, React and others. In fact some...
Read more >Building a Vue3 Typescript Environment with Vite - miyauci.me
1.Add lang="ts" to the script tag in all .vue files. 2.Change main.js ...
Read more >Introducing Vite, the Fastest Dev Server Ever - Vue.js 3 Course
Before using Vite, run a regular HTTP server with python 3: python -m http.server . This is to emphasize what Vite is not...
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
Also, now I checked that the versons(client) 4.1.x works great (event with socket.io server 4.2.0) but something wrong with 4.2.0 client.
Please see my answer here: https://github.com/vitejs/vite/issues/4798#issuecomment-924620798