Why?
Vite already supports environment variables. These environment variables are statically replaced during build time. This works well for simple use cases, but what if we have a complicated setup where some functionality needs to be configured at the time of deployment(long after we build the app for production)?
I recently came across one such use case where I had to figure out a way to provide a configuration variable to an SPA built with Vite deployed via Docker/nginx when the container starts.