Make a second app called “appname-dev” and deploy that. Use that for testing. When you are ready to deploy code, push it to your actual app “appname”.
You can’t test a cloud environment in vite using the shopify cli, they don’t have any support for that. They would need to add support for it as its not something I or anyone else has control over.