Member-only story
Node.js 20.6.0 Now Supports .Env Files
Node.js is catching the breath after Deno.js run adding built-in support for environment files. No more dotenv dependencies necessary.
As we can read on the Deno page:
The Deno runtime offers built-in support for environment variables with Deno.env
Getting and setting env variables in Deno is also quite easy:
Deno.env.set("X", "y");
console.log(Deno.env.get("X")); // y
Node.js didn’t offer built-in support for env files. Meaning, that to configure your API urls for different stages, like dev or production, you had to install dotenv or other library.
The dotenv library is quite popular. It’s downloaded 34 million times per week. It already reached 16.3.1 version.
While handling .env files seems to be trivial, the development of dotenv shows it’s not so trivial at all and ot has to be under constant care.
So why Node.js decided with the 20.6.0 version that it will have a built-in support for .env files?
The release notes indicate some reasons, and Deno isn’t mentioned AFAIK.