astro
astro copied to clipboard
🐛 BUG: vite.envDir is ignored when building
What version of astro
are you using?
^1.0.0-beta.47
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm, npm
What operating system are you using?
Mac
Describe the Bug
When building a project the vite.envDir
is ignored, it works as expected using the dev server.
in the stackblitz repro
- check
npm run dev
-> it works, env printed to console and UI - check
npm run build && npm run preview
and all vars areundefined
- move
.env.local
to same folder asastro.config.mjs
- check
npm run build && npm run preview
and it works
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-tcuzrc-mzkyt7?on=stackblitz
Participation
- [ ] I am willing to submit a pull request for this issue.
Thanks for the simple repro @nrgnrg! Can confirm this occurs without the .local
extension as well.
Bumping up priority on anything that is a difference between dev and build!
Hello. I cannot reproduce this issue in the latest version of Astro. I suspect this was fixed by https://github.com/withastro/astro/pull/4344
Thank you for reporting this issue! If this rehappen to you, please open another issue and we'll take a look!