Node.js 20.6.0, the latest version of the asynchronous, event-driven JavaScript runtime, includes built-in env.
file support for configuring environment variables.
The update, cited as the “current” version of Node.js and announced September 4, can be downloaded from the project website. With env.
, Node.js proponents said the configuration file should follow the INI file format, with each line having a key-value pair for an environment variable. To initialize the Node.js application with predefined configurations, developers can use this CLI command: node—file=config.env index.js
. In addition, the change for environment variables enables definition of NODE_OPTIONS
directly in the .env
file, eliminating the need to put it in package.json
.
To read this article in full, please click here