nuxt/cli

Bun ignores `--dotenv` option

Opened this issue · 1 comments

ahas commented

Environment

  • Operating System: Linux
  • Node Version: v18.17.1
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.0
  • Package Manager: bun@1.0.14
  • Builder: -
  • User Config: devtools, app
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  1. Create multiple .env files: .env.local, .env.dev, .env.prod.
  2. Add --dotenv .env.dev to the dev command in package.json > scripts.
    For example: "dev": "nuxt dev --dotenv .env.dev"
    Even if executed with bunx nuxt dev --dotenv .env.dev, the result is the same.
  3. Write code that utilizes values from the .env.dev file, execute the dev command, and check the result.

Describe the bug

When running Nuxt with Bun, the --dotenv option does not work as specified.
If both .env.local and .env.dev files are created, it seems that the .env.local file is read with priority.

Additional context

No response

Logs

No response

This is likely due to a Bun-specific behaviour rather than Nuxt.