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
-2
View File
@@ -1,8 +1,6 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
const __APP_VERSION__: string;
namespace App {
// interface Error {}
// interface Locals {}
+5
View File
@@ -0,0 +1,5 @@
import { version } from '../../package.json';
export function load() {
return { appVersion: version };
}
+2 -4
View File
@@ -6,9 +6,7 @@
import { loadNotes } from '$lib/stores/notes.js';
import { onMount } from 'svelte';
const appVersion = __APP_VERSION__;
let { children } = $props();
let { data, children } = $props();
let sidebarOpen = $state(false);
onMount(() => {
@@ -27,7 +25,7 @@
</main>
<footer class="pb-4 pt-8 text-center text-xs text-gray-400 lg:ml-64">
Crumbs by Bretzel v{appVersion} &mdash; made with 🥨 in Strasbourg
Crumbs by Bretzel v{data.appVersion} &mdash; made with 🥨 in Strasbourg
</footer>
<Toast />