gen dts file for import.meat.env;
Get all env values in configResolved
hook, zero dependency.
/// <reference types="vite/client" />
interface ImportMetaEnv {
VITE_XXX: string
// and so on
};
import { envTypePatch } from 'vite-plugin-envtype-patch'
{
plugins: [
envTypePatch({})
]
}
- convert simple type for
javascript
value
import { TypeConvert } from 'vite-plugin-envtype-patch'
const typeConvert = new TypeConvert({ once: false })
typeConvert.genSimpleType({
a: 100,
})
// call toString
const output = `${typeConvert}