From 1ad8fffd1b335ba966b4a8e6eb42d3099294a1e4 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 ++++++++++++++------ 1 file changed, 22 insertions(+), 10 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 @@