vite-plugin-env-types
v0.1.4
Published
Automatically generate env type | 自动生成环境变量类型
Downloads
38
Maintainers
Readme
vite-plugin-env-types
Automatically generate env type
Motivation
Want to automatically get prompted for import.meta.env
instead of managing it manually 👉 vitejs.dev/guide/env-and-mode
Usage
install
npm i vite-plugin-env-types -D
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
}
License
Made with markthree
Published under MIT License.