Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env variables on root of Monorepo not working anymore [Was working in the previous versions] #11190

Open
MathewsJoseph25 opened this issue May 20, 2024 · 2 comments
Labels
bug Something isn't working npm Something that relates to the npm-compatible client

Comments

@MathewsJoseph25
Copy link

What version of Bun is running?

1.1.8+89d25807f

What platform is your computer?

Darwin 23.3.0 x86_64 i386

What steps can reproduce the bug?

Create a mono repo and in the root package.json file, write a script that cd into one of the packages and run one of the scripts (of the sub packages). Then, create a root .env file and add the variables there.

What is the expected behavior?

The env variables should work when the sub packages are run. It was working till I upgraded the bun package. I don't remember what the previous version was to let you know, but it was definitely working.

What do you see instead?

Env variables in the root of the mono repo isn't being added to the environment when sub packages are run, but if i add the .env file in the sub package folder, it is working.

Additional information

No response

@MathewsJoseph25 MathewsJoseph25 added the bug Something isn't working label May 20, 2024
@Electroid Electroid added the npm Something that relates to the npm-compatible client label May 20, 2024
@wallpants
Copy link

I encountered this problem as well. A workaround until it gets fixed is to manually specify the env file in every command. I know it's unnecessarily laborious, but it works.

// package.json
{
  "scripts": {
    "whatever": "bun run --env-file=../../.env whatever"
  }
}

@TheOrdinaryWow
Copy link

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working npm Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

4 participants