React-pdf/renderer fails with "failed to asynchronously prepare wasm: CompileError" in TypeScript projects (CRA & Vite)
Describe the bug Using @react-pdf/renderer in a TypeScript React project (CRA or Vite) fails to render PDF documents. The PDFViewer iframe remains empty, and the console shows the following error:
failed to asynchronously prepare wasm: CompileError
To Reproduce Steps to reproduce the behavior:
-
Create a new React project with TypeScript using CRA or Vite.
-
Install
@react-pdf/renderer. -
Import
Document,Page,Text, andPDFViewerfrom@react-pdf/renderer. -
Render a simple PDF using
<PDFViewer> -
Run
npm start(CRA) ornpm run dev(Vite). -
Open the browser and check the console.
Expected behavior The PDF should render inside the PDFViewer iframe (empty).
Screenshots
Desktop (please complete the following information):
- OS: Windows / Linux
- Browser : Chrome / Zen Browser ( Firefox based )
- React-pdf version 4.3.0
+1
+1