You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever I have a function with side-effects in the init() hook inside of my +hooks.server.js, in my case starting up RabbitMQ consumers, if I'm using vite with hot module reloading, there is no way for to clean up the side effects before a reload. This means I end up spinning 10x+ the number of consumers just doing simple code changes.
Describe the proposed solution
It would be really nice to be able to having something like hot.dispose inside of +hooks.server.ts to be able to clean up the side effects (or even exported from the vite plugin).
Alternatives considered
The current workflow is just to turn off HMR and manually restart on changes, which is painful.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
SvelteKit is just a Vite plugin; can you not just use hot.dispose?
I don't think so - I tried import.meta.hot and it wasn't defined in the server. It seems that this is possible in the client (I didn't try but all the examples are client side) but in the +server.hooks.ts it's not defined.
Describe the problem
Whenever I have a function with side-effects in the
init()
hook inside of my+hooks.server.js
, in my case starting up RabbitMQ consumers, if I'm usingvite
with hot module reloading, there is no way for to clean up the side effects before a reload. This means I end up spinning 10x+ the number of consumers just doing simple code changes.Describe the proposed solution
It would be really nice to be able to having something like
hot.dispose
inside of+hooks.server.ts
to be able to clean up the side effects (or even exported from the vite plugin).Alternatives considered
The current workflow is just to turn off HMR and manually restart on changes, which is painful.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: