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
bun's .env
automatic loading feature doesn't work well with Vite's one
#14912
Comments
Running |
Are you able to repro if using |
Ah, it did reproduce with It's happening because bun loads I'm not sure what Vite can do here. |
build
function does not use appropriate env file based on 'mode' option.env
automatic loading feature doesn't work well with Vite's one
I'd vote closing this one. We don't explicitly support Bun and this doesn't seem like something we should special-case. |
Let's close this one. I also think it should be handled on Bun's side |
Describe the bug
I am using the
build
function to programmatically build my vite project.I have a
build.ts
file that contains thebuild({ ... })
function invocation.I've set the
mode
to'production'
, however my.env.production
is not being recognized and vite is incorrectly using the.env.local
file.I made a repro repository which contains two env files:
When I run the build via
bun run build.ts
(could have also have been viats-node
), and I search forhttps://myproduction.dev
this value is not found. However, when I search forhttp://localhost:8080
, I can see that the value is found.Reproduction
https://gitlab.com/giioo/vite-build-bug-repro
Steps to reproduce
To reproduce, follow these instructions:
bun
orts-node
, run thebuild.ts
filebun run ./build.ts
dist/assets/
does not reference the env from.env.production
, but rather from.env.local
even though themode
has been set toproduction
for thebuild
function inside ofbuild.ts
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: