build(frontend): serve pdf.js wasm decoders at /pdfjs-wasm/ via static-copy

pdf.js 5.x moved the JBIG2/CCITTFax/JPEG2000 image decoders into
WebAssembly. The wasm lives in node_modules and was never web-served, so
those decoders failed to initialise and CCITT (G4 fax) scans painted
blank in production while rendering fine in dev.

Add vite-plugin-static-copy (devDependency) to copy
node_modules/pdfjs-dist/wasm/* into build/client/pdfjs-wasm/, so the
assets are emitted into the SvelteKit client build and survive the
production Docker image — not just `npm run dev`. Verified that
`node build` serves /pdfjs-wasm/jbig2.wasm with 200 + application/wasm.

Refs #708

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-01 20:05:34 +02:00
parent 50f554680c
commit 8d2ef97fe2
3 changed files with 175 additions and 0 deletions

View File

@@ -68,6 +68,7 @@
"typescript-eslint": "^8.47.0",
"vite": "^7.3.3",
"vite-plugin-devtools-json": "^1.0.0",
"vite-plugin-static-copy": "^4.1.0",
"vitest": "^4.0.10",
"vitest-browser-svelte": "^2.0.1"
}