emit event when the Vite dev server has finished closing. #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently
The Vite dev server instance is closed when I call the close method on the server instance returned by
listen
, however, the dev server uses resources (e.g. a port for the WebSocket) and those resources aren't freed synchronously.Proposal
Emit another event when the dev server has finished closing so that the caller of
listen
knows when it's safe to use those resources (e.g. by callinglisten
again)Context/Motivation
I want to have my backend be fully reloaded when its source code changes. Perhaps there are other ways to achieve this, but re-invoking
listen
and getting a new Server instance seems the most intuitive to me, right now.Note: I spent a few minutes trying to get the build/CI for the project working but ended up testing these changes by copy/pasting main.ts into my project. These changes worked for me. Any guidance on how to do this properly would be appreciated! Also thanks for sharing this project!