From 303dc9dcbdbc9521c4b8e593abb70d7c21f8d90e Mon Sep 17 00:00:00 2001 From: Camille Flajollet Date: Fri, 7 Feb 2025 12:20:59 +0200 Subject: [PATCH] fix config to display build number in user agent (#163) --- src/vite-env.d.ts | 9 +++++++++ tsconfig.json | 4 ++-- vite.config.ts | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/vite-env.d.ts 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' }),