From 23345e22e68ef800357672c95882b2a3487c46a6 Mon Sep 17 00:00:00 2001 From: Admin Date: Tue, 10 Mar 2026 18:20:35 +0500 Subject: [PATCH] fix(ui): fix chapter page SSR crash by lazy-loading marked Static import of 'marked' was included in the SSR bundle causing ERR_MODULE_NOT_FOUND on first server render. The import is only ever used inside onMount (client-only fallback path), so replace with a dynamic import() at the call site. --- ui/src/routes/books/[slug]/chapters/[n]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte b/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte index e305ba8..548096e 100644 --- a/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte +++ b/ui/src/routes/books/[slug]/chapters/[n]/+page.svelte @@ -2,7 +2,6 @@ import { onMount } from 'svelte'; import AudioPlayer from '$lib/components/AudioPlayer.svelte'; import type { PageData } from './$types'; - import { marked } from 'marked'; let { data }: { data: PageData } = $props(); @@ -42,6 +41,7 @@ if (!res.ok) throw new Error(`status ${res.status}`); const d = (await res.json()) as { text?: string }; if (d.text) { + const { marked } = await import('marked'); html = await marked(d.text, { async: true }); } else { fetchError = 'Chapter content not available.';