29 lines
2.2 KiB
JavaScript
29 lines
2.2 KiB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
import { readFileSync } from "fs";
|
|
import { join } from "path";
|
|
export function clientEntry(c) {
|
|
let jsFile = "/src/client/main.tsx";
|
|
let cssFiles = 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['index.html'];
|
|
if (entry) {
|
|
jsFile = `/${entry.file}`;
|
|
if (entry.css) {
|
|
cssFiles = entry.css.map((css) => `/${css}`);
|
|
}
|
|
}
|
|
}
|
|
catch (error) {
|
|
console.warn('Could not read Vite manifest, using fallback:', error);
|
|
// Fallback to a generic path
|
|
jsFile = "/assets/index-Ccx6A0bN.js";
|
|
cssFiles = ["/assets/index-RdX4PbOO.css"];
|
|
}
|
|
}
|
|
return c.html(_jsxs("html", { lang: "de", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { content: "width=device-width, initial-scale=1", name: "viewport" }), _jsx("meta", { name: "theme-color", content: "#ec4899" }), _jsx("meta", { name: "apple-mobile-web-app-capable", content: "yes" }), _jsx("meta", { name: "apple-mobile-web-app-status-bar-style", content: "default" }), _jsx("meta", { name: "apple-mobile-web-app-title", content: "Stargirlnails" }), _jsx("title", { children: "Stargirlnails Kiel" }), _jsx("link", { rel: "icon", type: "image/png", href: "/favicon.png" }), _jsx("link", { rel: "apple-touch-icon", href: "/icons/apple-touch-icon.png" }), _jsx("link", { rel: "manifest", href: "/manifest.json" }), cssFiles && cssFiles.map((css) => (_jsx("link", { rel: "stylesheet", href: css }, css))), process.env.NODE_ENV === 'production' ? (_jsx("script", { src: jsFile, type: "module" })) : (_jsxs(_Fragment, { children: [_jsx("script", { src: "/@vite/client", type: "module" }), _jsx("script", { src: jsFile, type: "module" })] }))] }), _jsx("body", { children: _jsx("div", { id: "root" }) })] }));
|
|
}
|