Skip to content

PengBoUESTC/vite-plugin-envtype-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
pengbo43
Sep 9, 2024
b660b4b · Sep 9, 2024

History

10 Commits
Aug 26, 2024
Sep 9, 2024
Sep 9, 2024
Sep 9, 2024
Sep 9, 2024
Sep 9, 2024
Aug 26, 2024
Aug 26, 2024
Aug 26, 2024
Sep 9, 2024
Aug 26, 2024
Sep 9, 2024
Sep 9, 2024
Sep 9, 2024
Aug 26, 2024
Aug 26, 2024
Aug 26, 2024
Sep 9, 2024

Repository files navigation

vite-plugin-envtype-patch

Basic

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
};

How to use

import { envTypePatch } from 'vite-plugin-envtype-patch'

{
  plugins: [
    envTypePatch({})
  ]
}

What's more

  • 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}

About

gen dts for import.meta.env

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published