diff --git a/playground/.env.development b/playground/.env.development index 6095a86..f54b02d 100644 --- a/playground/.env.development +++ b/playground/.env.development @@ -7,4 +7,5 @@ VITE_VERSION=122 # 测试一下很多个空格 VITE_GE="0" VITE_OBJECT="{ name: 'abc', value: '123' }" -VITE_ARRAY=123 +VITE_STRING=abc +VITE_ABC=124534 diff --git a/playground/types/auto-env.d.ts b/playground/types/auto-env.dts similarity index 88% rename from playground/types/auto-env.d.ts rename to playground/types/auto-env.dts index cdb3f2e..d3823ad 100644 --- a/playground/types/auto-env.d.ts +++ b/playground/types/auto-env.dts @@ -16,7 +16,8 @@ interface ImportMetaEnv { */ readonly VITE_GE: string readonly VITE_OBJECT: string - readonly VITE_ARRAY: number + readonly VITE_STRING: string + readonly VITE_ABC: number } interface ImportMeta { diff --git a/playground/vite.config.ts b/playground/vite.config.ts index 5c9ca47..0867173 100644 --- a/playground/vite.config.ts +++ b/playground/vite.config.ts @@ -5,6 +5,8 @@ import VitePlugin from '../src' export default defineConfig({ plugins: [ Inspect(), - VitePlugin(), + VitePlugin({ + dts: 'types/auto-env.dts', + }), ], }) diff --git a/src/core/constant.ts b/src/core/constant.ts index 2e055e6..4c10fe7 100644 --- a/src/core/constant.ts +++ b/src/core/constant.ts @@ -1,4 +1,4 @@ export const VITE_PLUGIN_NAME: string = 'vite-plugin-meta-env-dts' export const ENV_INCLUDES: string[] = ['.env.*'] export const ENV_PREFIX: string[] = ['VITE_'] -export const ENV_DTS: string = 'auto-meta-env.d.ts' +export const ENV_DTS: string = 'types/auto-meta-env.d.ts'