Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dishait/vite-plugin-env-types
Automatically generate env type | 自动生成环境变量类型
https://github.com/dishait/vite-plugin-env-types
dts env plugin types typescript vite
Last synced: 2 days ago
JSON representation
Automatically generate env type | 自动生成环境变量类型
- Host: GitHub
- URL: https://github.com/dishait/vite-plugin-env-types
- Owner: dishait
- License: mit
- Created: 2023-05-20T04:35:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-28T05:19:12.000Z (9 months ago)
- Last Synced: 2024-10-05T23:35:14.460Z (about 1 month ago)
- Topics: dts, env, plugin, types, typescript, vite
- Language: TypeScript
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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](https://vitejs.dev/guide/env-and-mode.html#intellisense-for-typescript)
## Usage
### install
```shell
npm i vite-plugin-env-types -D
```
### config
```ts
// 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"
}),
],
});
``````json5
// tsconfig.json
{
"include": ["./env.d.ts"] // Ensure that files are scanned
}
```
## License
Made with [markthree](https://github.com/markthree)
Published under [MIT License](./LICENSE).