Replies: 1 comment 3 replies
-
To avoid Next from reading your require('dotenv').config({ path: '.custom_env_filename' }) But in general I recommend having only one .env file that has different contents depending on the environment it is at. Ref: https://12factor.net/config And yeah, it is a bad idea to do |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We were using dotenv to load or .env files, but it seems now it loads the .env files based off off the NODE_ENV variable, and in our case using the NODE_ENV="staging" is not going to work since we're using material-ui, which requires NODE_ENV to be "production" for certain functionality (this wouldn't be a problem is that one was configurable too).
So what we were doing before was defining an APP_ENV="staging" and using it to load our .env files. is there any way to achieve this with the current version of nextjs?
if not, is there a way to turn off the automatic .env loading and allow Dotenv to do it instead?
Beta Was this translation helpful? Give feedback.
All reactions