Julien-R44 / vite-plugin-validate-env

✅ Vite plugin for validating your environment variables
MIT License
164 stars 6 forks source link

Add a config to look for a custom `env.ts` file path. #22

Closed pewulfman closed 6 months ago

pewulfman commented 6 months ago

The configuration that makes more sense to me with this tools using typescript and vite is to follow what documentation says about passing no option to the plugin and put the env in an env.ts file, then use it in env.d.ts to make import.Meta.env typesafe.

This allow to keep only one copy of the env definition, have typescript verify that we use them correctly and this plugin check that they are present to fail at bootup instead of failing at runtime.

My issue is that I would like to have customization regarding the name of the files (ideally I want to name it vite-env.ts). I looked at the code, it seem not difficult to do (by that I mean I can do it) and would improve quality of life.

Thank for taking my opinion into consideration

Julien-R44 commented 6 months ago

Hey, thanks for the suggestion

it has been added with 1.1.0

see readme for details : https://github.com/Julien-R44/vite-plugin-validate-env#custom-config-file-path

pewulfman commented 6 months ago

Hey, I am impress by the reactivity ! Thanks !