Skip to content

dotenv #14986

Open
Open
dotenv#14986
@AlexBlokh

Description

@AlexBlokh

What version of Bun is running?

1.1.34

What platform is your computer?

Darwin 22.4.0 arm64 arm

What steps can reproduce the bug?

dotenv consumption does not respect order stated in the docs and for NODE_ENV only works with test value

.env.local

DB_USER=LOCAL

.env.test

DB_USER=TEST

.env.development

DB_USER=DEV

index.ts

console.log(process.env.DB_USER);

then run

> NODE_ENV=development bun run index.ts
LOCAL

> bun run index.ts
LOCAL

> NODE_ENV=test bun run index.ts
TEST

What is the expected behavior?

> NODE_ENV=development bun run index.ts
DEV

> bun run index.ts
LOCAL

> NODE_ENV=test bun run index.ts
TEST

What do you see instead?

> NODE_ENV=development bun run index.ts
LOCAL

> bun run index.ts
LOCAL

> NODE_ENV=test bun run index.ts
TEST

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions