honojs / vite-plugins

Vite Plugins for Hono
https://hono.dev
134 stars 35 forks source link

Add support to React Refresh #141

Open gaetan-puleo opened 5 months ago

gaetan-puleo commented 5 months ago

React refresh is not working when using @hono/vite-dev-server and vite-react-plugin.

To make it works, we should transform the HTML with viteServer.transformIndexHtml(req.url, html)

https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react

gaetan-puleo commented 5 months ago

It could be possible to do it here https://github.com/honojs/vite-plugins/blob/main/packages/dev-server/src/dev-server.ts#L168

The issue is we are using Stream here.

gaetan-puleo commented 5 months ago

As a workaround take a look here. https://github.com/honojs/vite-plugins/pull/142#issuecomment-2155096162

gaetan-puleo commented 5 months ago

We can close the issue if you want @yusukebe or we can wait for an "official way" to do it.