Steps:
$ npm run dev # or run preview
...
Use the port forwarding tool, check that it works.
Stop the server. Restart.
Expectation
Tool forwarding remains until it's terminated in its window.
Actual
Port forward stops when such a port is closed in the VM.
Suggestions
The script could try to reconnect (in a loop).
Also check that the daemon mode (-d) works the same.