Skip to content

Does parcel use dotenv, or dotenv flow? The documentation is incomplete and confusing #1013

@rsimp

Description

@rsimp

Is Parcel using dotenv as it claims, or dotenv-flow? It links to dotenv but supports multiple env files in the same manner as dotenv-flow, which is not included behavior with dotenv and actively warns against it. However dotenv-flow has specific rules on which env files have higher precedence. Command line env variables have the highest precedence, and .env.local is still loaded for test. This is the behavior that next.js and create react app uses.

I think parcel needs to go with one or the other, link to it, and use the same logic. If not remove the link and just document it's own rules : What files can be source controlled? What files overwrite others? Are command line env variables overwritten if defined etc.

Also what is the rationale behind not using .env.local for test? Env variables loaded via jenkins/aws/etc are higher priority than ones defined in env files with dotenv-flow. .env.local will have unsourced secrets and may need to be different than the actual test environment (dev/qa/staging etc), but API keys may still be necessary for any integration or end-to-end testing. Precedence order should make sure it all works correctly which is the main concern when using multiple .env files. I'd probably end up with two local env files with the same configuration and I'm not sure I'm understanding what the benefit is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions