From c98d31e19f3fb927732bcd458b85bada7266adae Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 23 Mar 2026 22:30:54 +0100 Subject: [PATCH] fix(frontend): load pdfjs-dist dynamically to avoid SSR crash (#39) Static import of pdfjs-dist fails during SSR because DOMMatrix and other browser globals are unavailable in Node.js. Move the import into onMount so it only ever executes in the browser. A plain pdfjsLib variable holds the module; a $state boolean pdfjsReady triggers the load-document effect once the library is available. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/components/PdfViewer.svelte | 32 +++++++++++++------ .../src/routes/documents/[id]/+page.svelte | 1 - 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/frontend/src/lib/components/PdfViewer.svelte b/frontend/src/lib/components/PdfViewer.svelte index 224b2cc6..d22ca2b4 100644 --- a/frontend/src/lib/components/PdfViewer.svelte +++ b/frontend/src/lib/components/PdfViewer.svelte @@ -1,9 +1,6 @@