-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
env variables do not work #3584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code
|
Oh, I missed that part! Thank you! |
My varibales are started with VUE_APP_ but still cannot read them. |
You should check this #767 (comment) |
If you have prefixed yours with VUE_APP_ Hope you tried accessing it using process.env.VUE_APP_MY_ENV and not just VUE_APP_MY_ENV |
I have this problem as well. We are using the following files: The The strangest thing is that variables from all files are available when built on a Mac, but only the ones from .env are available when built on a Windows machine. |
I was having that problem after changing env variables and not seeing updated values in the app. Solution was to restart development mode to load new env variables values in the app (stop and run |
If the only environment started with VUE_APP is available, then where should I store my private secret API key? Isn't it |
To anyone who is still not getting it to work, please make sure your env files (.env, .env.development, .env.development.local, .env.production) have a They started working after changing to |
Excuse me, how did you convert your files from UCS-2 LE BOM to UTF-8? |
Version
3.4.1
Environment info
Steps to reproduce
1.1. Manually select features
1.2. Babel, Router, Vuex, CSS Pre-processors
1.3 Use history mode for router? Y
1.4 Pick a CSS pre-processor: Sass/SCSS (with dart-sass)
1.5 Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files
1.6 Save this as a preset for future projects? N
What is expected?
console output should contain "FOO":"bar" env variable
What is actually happening?
Seems like .env is not read at all. 'FOO' variable is not defined in process.env
The text was updated successfully, but these errors were encountered: