-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Ignore only local env files in Vite templates #9065
Conversation
In Vite `.env` files work a bit differently, where `.env` itself is intended to be public, and `.env.local` is the one that should be ignored by Git. But a Vite project can have more `.env` files, like `.env.development`, which is used only in development mode, and overrides values in `.env`, then you can have `.env.development.local` as well and so on. https://vitejs.dev/guide/env-and-mode.html#env-files
|
I'l defer to @pcattori and @markdalgleish here but I found this Vite recommendation surprising. I've always git ignored all IMO, loosening this to |
Fair points. I'm mostly just annoyed with migrating from a git-ignored For me it's nice that I just realized that it may also be good to create an |
For whatever reason, we've seen a lot of unfamiliarity with Vite since adding support in Remix. We keep getting a lot of issues filed that are really Vite questions so we points folks to the vite docs. So I worry that we can't assume folks already know the Vite-isms.
This is exactly my fear haha - I don't want folks to find out the hard way by accidentally leaking a secret... The important thing here IMO is that we haven't restricted any options from end users. We've just defaulted to an arguably "safer" setup, but advanced users like yourself are one line away from the proper (but potentially riskier) Vite approach. |
I can't say that I don't agree, it may be most appropriate choice for this project. People can easily opt into Vite's |
I'm coming in late to this one, but I agree with @brophdawg11's take on this. To me this doesn't feel like a "Vite-ism" since it's just a template concern and it's ultimately completely user controlled. I'm happy with our more conservative approach since the cost of getting it wrong is too high. If anyone disagrees, it's an easy change. |
In Vite
.env
files work a bit differently, where.env
itself is intended to be public, and.env.local
is the one that should be ignored by Git. But a Vite project can have more.env
files, like.env.development
, which is used only in development mode, and overrides values in.env
, then you can have.env.development.local
as well and so on.https://vitejs.dev/guide/env-and-mode.html#env-files
It appears that Vite uses just
*.local
pattern for their templates, but I'm not comfortable with that 😄