Home

Awesome

vite-plugin-env-types

Automatically generate env type

<br />

Motivation

Want to automatically get prompted for import.meta.env instead of managing it manually 👉 vitejs.dev/guide/env-and-mode

<br />

Usage

install

npm i vite-plugin-env-types -D
<br />

config

// vite.config.ts
import { defineConfig } from "vite";
import EnvTypes from "vite-plugin-env-types";

export default defineConfig({
  plugins: [
    EnvTypes({
        dts: './types/.env.d.ts' // Write file location, default to "env.d.ts"
    }),
  ],
});
// tsconfig.json
{
    "include": ["./env.d.ts"] // Ensure that files are scanned
}
<br />

License

Made with markthree

Published under MIT License.