I forgot about this topic. Thanks @bluepuma77 for stepping in with the command to test the variable. Yes, I meant that.
That is for making an image, but your compose file should not have a space after the equal sign in the environment section. You either the mapping syntax with a space after the colon or the list syntax without space. Otherwise your URL will start with a space and if your app doesn’t trim that space, the URL will be invalid and could be ignored, but that is just a huge guess without knowing the app.
Mapping:
environment:
VITE_BASE_URL: ${VITE_BASE_URL:-http://localhost:5500}
List:
environment:
- VITE_BASE_URL=${VITE_BASE_URL:-http://localhost:5500}