dotenv-webpack icon indicating copy to clipboard operation
dotenv-webpack copied to clipboard

starting my application failed if .env is not exist.

Open maoryadin opened this issue 1 year ago • 1 comments

This is weird behaviour, espically because i have .env.defaults. starting my application failed if .env is not exist.

Why it is strictly needed, if i do not want to include .env in addition for my .env.defaults? Hope someone can help me understand it better, thank you.

maoryadin avatar Jun 23 '24 15:06 maoryadin

Think its because the default is set and then it uses that as a prefix to find .defaults / would have to see what is going on and experiment with it. Could try to see if allowEmptyVar could be a work around. That would require safe as well, but use case is still interesting.

Learning and playing rn and I was setting up my project in this exact manner. To get it to work I had to change the path to the environment that I wanted and then enable defaults more so to be a common amongst my different environments. Which is what I assume the intended functionality was supposed to be.

Wasn't very straight forward and don't actually know if that's what it was meant for because originally I just wanted to use safe to load the specific environment I wanted and populate what wasn't declared and assumed since I had defaults it would merge that first then use my specific environment.

Anyway. Assuming that this would need a ".env" file to start with and then it can work and it won't create one just utilize what is given. I only very briefly scrolled through code so most of this is black box analysis. Salt to taste.

littlen101 avatar Jul 13 '24 18:07 littlen101