The current regex should already ignore export\s+. If this isn't the case, please open a Pull Request with a failing test.
@maxbeatty I should have been more clear. I don't want it to skip the entire line, I want it to be able to strip leading export\s+ and parse the subsequent environment variable as usual.
See my pull request #118 for a fix.
I just lost like half an hour trying to debug why dotenv wasn't working in my project. It turns out it's because this library doesn't understand export lines. dotenv silently rejects these lines, without even giving so much as an error or warning.
Isn't the entire point of this library to replace the need for . .env to get the right environment variables? Why isn't this compatible with that basic format? Why was the PR not only closed, but then locked to prevent further discussion? I don't understand, and I'm frustrated.
The behavior of not parsing lines with a leading export is very surprising to me. I am new to NodeJS development, but have been doing Ruby and Python development for many years. As has been mentioned before, the dotenv libraries for those languages (and apparently many other languages) accept and parse lines with leading exports.
I'm not commenting on whether it is right or wrong for this library to behave differently than all of the other dotenv libraries, but I'm confident in saying that it is objectively surprising.
Actually, I will comment on whether it is right or wrong; I think it's wrong :)
In any case, thank you for your work and contributions to the community. Easy for me to leave a critical comment when you're the one actually writing code and giving it away for free.
Most helpful comment
I just lost like half an hour trying to debug why dotenv wasn't working in my project. It turns out it's because this library doesn't understand
exportlines.dotenvsilently rejects these lines, without even giving so much as an error or warning.Isn't the entire point of this library to replace the need for
. .envto get the right environment variables? Why isn't this compatible with that basic format? Why was the PR not only closed, but then locked to prevent further discussion? I don't understand, and I'm frustrated.