unplugin-vue-router
unplugin-vue-router copied to clipboard
Adjust Vite HMR implementation
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 returnsvoid
notPromise
.