I dont use sail, but rather a custom built docker setup. But I got mine working by running vite from inside docker
https://laravel.com/docs/8.x/sail#executing-node-npm-commands
Remember to open the port in you docker-compose.yml file (I have set mine to run on 3009 in vite.config.js)
ports:
- 3009:3009
Note that I have a helper method that checks if the dev server is running to ensure that the correct handler is used. I used this tutorial: https://sebastiandedeyne.com/vite-with-laravel/