From f4d9f60fc9b7baf39f511a7976484e0f77e90222 Mon Sep 17 00:00:00 2001 From: elpatron Date: Wed, 1 Oct 2025 22:49:57 +0200 Subject: [PATCH] =?UTF-8?q?fix(client-entry):=20verwende=20korrekte=20Asse?= =?UTF-8?q?t-Pfade=20aus=20Vite-Manifest=20f=C3=BCr=20Production-Build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routes/client-entry.tsx | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/server/routes/client-entry.tsx b/src/server/routes/client-entry.tsx index 3017886..543494b 100644 --- a/src/server/routes/client-entry.tsx +++ b/src/server/routes/client-entry.tsx @@ -1,9 +1,33 @@ /** @jsxImportSource hono/jsx */ import type { Context } from "hono"; +import { readFileSync } from "fs"; +import { join } from "path"; import type { BlankEnv } from "hono/types"; export function clientEntry(c: Context) { + let jsFile = "/src/client/main.tsx"; + let cssFile = null; + + if (process.env.NODE_ENV === 'production') { + try { + // Read Vite manifest to get the correct file names + const manifestPath = join(process.cwd(), 'dist', '.vite', 'manifest.json'); + const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')); + const entry = manifest['src/client/main.tsx']; + if (entry) { + jsFile = `/assets/${entry.file}`; + if (entry.css) { + cssFile = entry.css.map((css: string) => `/assets/${css}`); + } + } + } catch (error) { + console.warn('Could not read Vite manifest, using fallback:', error); + // Fallback to a generic path + jsFile = "/assets/index-Ccx6A0bN.js"; + } + } + return c.html( @@ -11,12 +35,15 @@ export function clientEntry(c: Context) { Stargirlnails Kiel + {cssFile && cssFile.map((css: string) => ( + + ))} {process.env.NODE_ENV === 'production' ? ( -