Skip to content

Improve the way .env configuration file is loaded #49514

@xavierfoucrier

Description

@xavierfoucrier

What is the problem this feature will solve?

Make environment variables configuration file loading more fluent.

What is the feature you are proposing to solve the problem?

Instead of loading it using a CLI command like node --env-file .env, it would be event better to use a package.json field containing the environment filename, this way, Node can automatically load the environment variables every time a NPM script is running.

Another idea would be to let Node detect if a default .env file exists, and load it for each NPM script that is running. According to this idea, may be we could have a flag like --no-env-file or --env-file none to tell Node to not load environment file by default.

This could be the default behavior.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command line interface.feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions