Skip to content

Commit

Permalink
fix config to display build number in user agent (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamilleFljt authored Feb 7, 2025
1 parent 48b608a commit 303dc9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_BUILD_VERSION: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }),
Expand Down

0 comments on commit 303dc9d

Please sign in to comment.