Skip to content

Follow dotenv-flow variable precedence #491

Closed
@jleem99

Description

@jleem99

The documentation for this library mentions that it follows the dotenv-flow for multi-environment variable loading. (link)

However, I've noticed a minor difference when compared to the dotenv-flow.
According to the dotenv-flow's variables overwriting priority, the variable merging order should be:

  1. .env
  2. .env.local
  3. .env.development
  4. .env.development.local
  5. Command line variables

But in practice, when NODE_ENV='development', the order of variable merging in this library seems to be:

  1. .env
  2. .env.development
  3. .env.local
  4. .env.development.local
  5. Command line variables

This had lead some confusions, for instance, mode-specific variables being unexpectedly overwritten by variables from the .env.local file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions