HMR "before reload" hook possible? #4956
Unanswered
enso-media
asked this question in
Help
Replies: 1 comment 3 replies
-
Two options available. Check out the docs : https://github.com/Julien-R44/hot-hook#api
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im developing an application that is able to spawn individual processes for specific integrations.
The main app has a service thats manages those integration processes and is able to start and stop them. This i done by using nodes child processes and fork() an adonis ace command that runs an integration.
Everything works well so far, except for some annoying problems when using HMR while developing:
Some of those integrations for example communicate with hardware via an own TCP server on a specific port that is started by the process.
Now when i change anything in the source adonis hot reloads, but the forked processes keeps running and gets restarted again, resulting in "address/port already in use" for the started TCP server.
Now im trying to find a solution to hook into the HMR lifecycle before it reloads, so that i can gracefully exit running child processes and close server connections to avoid those problems.
As Adonis using its own HMR i cannot use vite events.
There is the "onSourceFileChanged" assembler hook in adonisrc that i hoped i can use, however nothing happened as it seemed that it doesnt get triggered for HMR changes.
Any recommendations how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions