🐛 BUG: `import.meta.env` variables missing
What version of astro are you using?
1.0.0-beta.65
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
Mac 12.4
Describe the Bug
When attempting to use import.meta.env.PROD mentioned here, I'll get an error saying this PROD doesn't exist on undefined. In fact, it seems even import.meta` is undefined.
I've recreated this on the linked stackblitz.
Perhaps I'm missing something though? :) Thanks for the help!
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-gm8tmg-wgv8zg?file=astro.config.ts
Participation
- [ ] I am willing to submit a pull request for this issue.
Hi @austin-meadows!
import.meta.env is not available yet in astro.config.ts — it is only created after your config has been loaded. (We should probably add a note to this effect to the docs page.)
Some environment variables are available in config files using process.env but I suspect because this one is set by Astro, it won't be yet.
This should be fixed by https://github.com/withastro/astro/pull/3617, which I still need to wrap up
@delucis Ah okay, I understand! :) I must've gotten this impression from Vite, or I'm just misremembering entirely. 😂
@natemoo-re And that's awesome, thanks!!