guocaoyi / create-chrome-ext

🍺 Scaffolding your Chrome extension! Boilerplates: react \ vue \ svelte \ solid \ preact \ alpine \ lit \ stencil \ inferno \ vanilla
MIT License
1.42k stars 106 forks source link

[BugReport] vite ws connect failed #61

Open warjiang opened 8 months ago

warjiang commented 8 months ago

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

Valeriy-Burlaka commented 8 months ago

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!

warjiang commented 8 months ago

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

warjiang commented 8 months ago

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

ajaxjs commented 7 months ago

same problem

Try add this to your vite config

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

fixed!

dejurin commented 6 months ago

This bug only in dev.