unplugin-vue-router icon indicating copy to clipboard operation
unplugin-vue-router copied to clipboard

Adjust Vite HMR implementation

Open jods4 opened this issue 5 months ago • 1 comments

server.reloadModule(mod) is documented as the way to push HMR here: https://vitejs.dev/guide/api-javascript.html#vitedevserver I've used it in beforeWriteFiles and it worked for me.

I made updateRoutes non-async because:

  • You could await reloadModule but I don't think you should, and you didn't await the websocket in previous code either
  • Everywhere you call updateRoutes, you don't await it.
  • Interface ServerContext says it returns void not Promise.

jods4 avatar Sep 06 '24 17:09 jods4