I feel like I must be missing something. But in my attempts to set this up configResolved() is called after config(). Which means that the code to inject env vars into the config is called before loadEnvFiles()
loadedEnv hasn't been loaded at this point. So the function just returns.
https://github.com/stacksjs/vite-plugin-dotenvx/blob/b212055bbf17ede0f812de8af8de7f0e1294f269/src/index.ts#L178-L179
Moving the call of loadEnvFiles fixes things for me. But presumably there was a reason why the logic was split between config and configResolved