diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..c019781 --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly VITE_BUILD_VERSION: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} diff --git a/tsconfig.json b/tsconfig.json index 38ea1fc..b10d4db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,8 +5,8 @@ "typeRoots": ["node_modules/@types"], "baseUrl": ".", "moduleResolution": "node", - "target": "ES2019", - "module": "commonjs", + "target": "esnext", + "module": "esnext", "lib": ["es2015", "es2016", "es2017", "dom"], "strict": true, "sourceMap": true, diff --git a/vite.config.ts b/vite.config.ts index c269283..bc6139c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -51,6 +51,7 @@ export default defineConfig({ }, define: { 'process.env': process.env, + 'import.meta.env.VITE_BUILD_VERSION': JSON.stringify(process.env.BUILD_VERSION || 'dev'), }, plugins: [ dts({ outDir: 'dist/types' }),