I'm trying to create a system in my SvelteKit app where it shows you info about the current app version (ideally a Git commit hash and description) on a certain page. I tried using Vite's define feature to do this at build time but it doesn't seem to work. How do I add something like this?
Here's an example of what I tried to do:
Vite config in svelte.config.js
vite: () => ({
define: {
'__APP_VERSION__': JSON.stringify('testfornow')
}
})
index.svelte:
<script lang="ts">
const version: string = __APP_VERSION__;
</script>
<p>Current App version: {version}</p>