ReviewOS

stacks/vite-plugin-dotenvx

dotenvx env is loaded after config is injected into frontend env

#14
Open XuluWarrior opened this 9 days ago ·
9 days ago

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

Sign in to comment on this issue.