.env.production variable not loaded in vite.config #18054
Unanswered
seanwuapps
asked this question in
Q&A
Replies: 1 comment
-
You are missing - export default defineConfig((mode) => {
+ export default defineConfig(({ mode }) => { https://vitejs.dev/config/#using-environment-variables-in-config |
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
-
Hey guys, I'm trying to have a
.env
file that sets the base url of the app. The doc site says I should be able to have a.env.production
file with that.I just can't seem to get it working. In my
vite.config.js
file, i load up theprocess.env
using theloadEnv
function, but when i log out my env variable it's always undefined.Repro: https://stackblitz.com/edit/vitejs-vite-kegsff?file=vite.config.js
Expected:
The variable defined in .env.production file gets loaded and overwrites .env file.
Beta Was this translation helpful? Give feedback.
All reactions