You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The decision to ignore .env by default which many people also use for sensitive environment variables outweighs the minor inconvenience of having to copy over stuff from a .env.example file - therefore closing. You are of course free to adjust this for your own project and modify the .gitignore that create-svelte produces.
Describe the problem
I'm always frustrated when cloning a sveltekit project with an environment.
I need to manually create a
.env
file, so that the typescript errors from importing on$env/static/private
go away. Egcp .env.example .env
.Why can't I just
pnpm install && pnpm dev
after cloning 😬Describe the proposed solution
From the way SvelteKit handles environment, it would make sense to change this in the starter template's
.gitignore
:.env.local
and.env.*.local
, that's where the secrets or custom configs will be.env
or.env.{production,development,test}
: commit.env
to the project by default! It should only contain non-sensitive default values.SvelteKit refers to how Vite handles env
The
.env.*.local
files overrides the.env
files, and Vite recommend ignoring the local files but not the other.So you can have:
.env
(and empty strings egSECRET=
for secrets, so that TS is happy).env.local
: secrets & custom overridesAlternatives considered
Change SvelteKit to load default env from
.env.example
to make TS happy, but it's a breaking change.Here only the docs + starter template need to be changed.
Importance
would make my life easier
Additional Information
Original comment here: #2925 (comment)
The text was updated successfully, but these errors were encountered: