Replies: 3 comments 1 reply
-
Hey, have you tried this in define: {
'process.env': process.env
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
For dev mode this works for me for getting the git version: "dev": "VITE_GIT_VERSION=$(git log -1 --pretty=format:%h -- .) vite" |
Beta Was this translation helpful? Give feedback.
1 reply
-
For anyone facing this exact situation: Instead of: Try this: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
According to this thread I've tried everything but I still can't get my env variables.
I've command:
It works if I try to dump
process?.env?.SOMETHING
anywhere else (ex. tailwind config) it showswhatever
but I can't get it working in vite.config. This situation is exactly described in this comment but it doesn't work for me. I've also triedloadEnv()
but it looks like it is only dot.env loader. Another comment says It is out of date because of conditional config but all it knows it is in "build" command and "production" mode which is useless for this.How do you get ENV variable in Vite config?
I'm using Vite 2.7.X
Beta Was this translation helpful? Give feedback.
All reactions