Skip to content

Pass multiple .env files on the CLI #1248

@Lenni009

Description

@Lenni009

Describe the feature

In Nuxt v4.3.0, you could pass multiple .env files on the CLI like this:

nuxt dev --dotenv .env.development --dotenv .env.local

Since Nuxt v4.3.1, this no longer works and only one --dotenv argument is accepted.

There may be cases where someone wants to use multiple files, for example a .env.local for sensitive API keys and a .env.development for non-sensitive configuration data like DB URLs.

Since the config in .env.development is only for dev and would result in a broken application in prod, it doesn't make much sense semantically to put its contents into a .env file.

The solution could be implemented with a separator, like this (although I have to admit it looks a bit ugly):

nuxt dev --dotenv .env.development,.env.local

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions