fix(pdf-viewer): use static worker + lazy page rendering

Worker copied to public/ via prebuild script (avoids Vite resolution issues).
IntersectionObserver renders only visible pages (+200px ahead) instead of all
at once, fixing performance for large PDFs.
This commit is contained in:
Hibryda 2026-03-11 01:27:54 +01:00
parent 199873781b
commit a74d3a74d3
3 changed files with 97 additions and 50 deletions

View file

@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"prebuild": "cp node_modules/pdfjs-dist/build/pdf.worker.min.mjs public/pdf.worker.min.mjs",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",