How to use wasm NPM package (pdfium)
I'm trying to use pdfium, but run into errors:
1.
import { PDFiumLibrary } from "@hyzyla/pdfium/browser/base64";
Gets me built and deployed, but runtime error of (error) failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder
b/c Cloudflare disallows runtime fetching of wasm (even though the base64 is in my code itself).
2. I tried updating wrangler.jsonc
, but this property is not supported in wrangler:
3. I've also tried storing the wasm in my public dir and fetching from /pdfium.wasm
but that again runs into the same error as attempt 1.
4. Tried vite-plugin-wasm
, but get this error:
Any ideas?0 Replies