create-chrome-ext icon indicating copy to clipboard operation
create-chrome-ext copied to clipboard

[BugReport] vite ws connect failed

Open warjiang opened this issue 2 years ago • 5 comments

when i use create-chrome-ext with react + ts + vite, after install dependencies and run npm run dev, it comes with websockets connect failed: image

warjiang avatar Nov 03 '23 07:11 warjiang

I had this error too, - looks like Vite regression or a configuration issue. Some people report that downgrading to "vite": "~4.2.2" helped them. For me, adding Vite configuration from this answer solved the issue. Hope this helps!

Valeriy-Burlaka avatar Nov 05 '23 12:11 Valeriy-Burlaka

@Valeriy-Burlaka thks, after donwgrade vite, it works, and the hmr as well 👍

warjiang avatar Nov 06 '23 02:11 warjiang

@guocaoyi maybe should lock version of vite or add this problem in FAQ

warjiang avatar Nov 06 '23 02:11 warjiang

same problem

Try add this to your vite config

server: { port: 5173, strictPort: true, hmr: { port: 5173, }, },

fixed!

ajaxjs avatar Nov 18 '23 06:11 ajaxjs

This bug only in dev.

dejurin avatar Dec 17 '23 22:12 dejurin