You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently migrated from Create React App to Vite and we are encountering issues with the way dotenv and dotenv-expand is configured.
Our .env file used to look like this:
REACT_APP_DEPLOY_ENV=$DEPLOY_ENV
This allowed our app to read the global DEPLOY_ENV variable as REACT_APP_DEPLOY_ENV.
We changed it to:
VITE_DEPLOY_ENV=$DEPLOY_ENV
But the VITE_ prefixed variable is never defined.
I don't think this is intended, as dotenv-expand should have access to the environment variables in order to work, but right now it doesn't seem to work.
Note that this example doesn't work either:
VITE_NOT_WORKING=$VITE_WORKING
In this last example import.meta.env.VITE_WORKING will work but import.meta.env.VITE_NOT_WORKING will be empty.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
We recently migrated from Create React App to Vite and we are encountering issues with the way dotenv and dotenv-expand is configured.
Our
.env
file used to look like this:This allowed our app to read the global DEPLOY_ENV variable as REACT_APP_DEPLOY_ENV.
We changed it to:
But the VITE_ prefixed variable is never defined.
I don't think this is intended, as dotenv-expand should have access to the environment variables in order to work, but right now it doesn't seem to work.
Note that this example doesn't work either:
In this last example
import.meta.env.VITE_WORKING
will work butimport.meta.env.VITE_NOT_WORKING
will be empty.Reproduction
https://stackblitz.com/edit/vitejs-vite-6jvttl?file=main.js
System Info
System: OS: Linux 5.0 undefined CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages: vite: ^3.1.0 => 3.1.0
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: