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

2.9 Breaking change : default envDir now depends on alternative root #7557

Closed
7 tasks done
Maniae opened this issue Apr 1, 2022 · 2 comments · Fixed by #7563
Closed
7 tasks done

2.9 Breaking change : default envDir now depends on alternative root #7557

Maniae opened this issue Apr 1, 2022 · 2 comments · Fixed by #7563
Labels
documentation Improvements or additions to documentation pending triage

Comments

@Maniae
Copy link

Maniae commented Apr 1, 2022

Describe the bug

In 2.9, running vite command using an alternative root has vite looking for .env files in the alternative root directory.

The provide example can be fixed by adding a vite config file using this config : envDir: ../
I don't know if this is intended. Prior to 2.9, specifying an alternative root required specifying the vite.config file path if it was not located in the alternative folder, but didn't change the envDir default path. It now does and breaks projects using environment files not located in the alternative root folder.

Reproduction

https://stackblitz.com/edit/vitejs-vite-yvysne?file=package.json

System Info

any

Used Package Manager

npm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Apr 1, 2022

Introduced in #6995. The docs initially mentioned that envDir defaults to the root, so if you change the root, it should load env files in that root directory only. So I don't think it's a breaking change.

@Maniae
Copy link
Author

Maniae commented Apr 1, 2022

The way I see it is that this is a "breaking bug fix". Meaning that some projects may have been relying on the 2.8 behavior, event though it was the wrong one (I encountered the issue using .env file at the root project of a monorepo for instance).
Maybe a warning in the 2.9 release not could be enough

@bluwy bluwy added the documentation Improvements or additions to documentation label Apr 1, 2022
@bluwy bluwy mentioned this issue Apr 1, 2022
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation pending triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants