I too had the issue and after LOTS of troubleshooting, I found an import that I can swear I did not add on my own.
import { send } from 'vite';
That killed the code, and almost me for 4 days. Now we are back on track.