Since Node.js v20.6 instead of using the popular dotenv package to read your .env file and make its values available under process.env, you can now pass --env-file .env to node to achieve the same, without a dependency.

Find out more…

Here is an example of the changes needed to upgrade:

config.ts

package.json

Tipp: If you deploy your app as a Docker container, don’t forget to add .env to your .dockerignore file, as typically you will explicitly set your environment variables in your deployment and don’t want your .env file to interfere with that.

No comments yet!

Community stats

  • 4

    Monthly active users

  • 63

    Posts

  • 19

    Comments

Community moderators