motdotla / dotenv

Loads environment variables from .env for nodejs projects.
https://www.dotenvx.com
BSD 2-Clause "Simplified" License
19.01k stars 853 forks source link

fix: Set NodeJS v14 as the oldest supported engine version #811

Closed lekspyl closed 6 months ago

lekspyl commented 6 months ago

dotenv v16.4.3 can't be used with Node 12 because the change introduced in the PR https://github.com/motdotla/dotenv/pull/805 contains an optional chaining operator that is supported by NodeJS starting from v14, thus running it with v12 engine version results in the

  if (options?.encoding) {
              ^
SyntaxError: Unexpected token '.'

exception.

Considering that Node v12 has reached EOL I assume it's better to set v14 as the oldest version constraint.

motdotla commented 6 months ago

maybe, but it would be nice to still support older versions. many people still run node 12 in production. @thanosd would you like to take a crack at modify that to support node 12?

motdotla commented 6 months ago

tests passed here for 12. https://github.com/motdotla/dotenv/pull/812

and released under v16.4.4.

thank you for contributing this @lekspyl. i'm going to close though.

thanosd commented 6 months ago

You beat me to it.