fix: pass app version via server load instead of Vite define

The Svelte 5 SSR compiler was optimizing away the __APP_VERSION__
constant set via Vite's define, causing the version to be missing
from the production footer. Use a +layout.server.ts load function
to pass the version from package.json instead.

Also bumps version to 0.1.6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Frederic Cabassut
2026-03-06 07:18:59 +01:00
co-authored by Claude Opus 4.6
parent 3b3a1b4ff0
commit a9779c93aa
5 changed files with 8 additions and 13 deletions
-6
View File
@@ -1,15 +1,9 @@
import { readFileSync } from 'node:fs';
import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(pkg.version)
},
plugins: [
tailwindcss(),
sveltekit(),