react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

React-pdf/renderer fails with "failed to asynchronously prepare wasm: CompileError" in TypeScript projects (CRA & Vite)

Open v3-Panwar-Ujjwal opened this issue 3 months ago • 2 comments

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:

  1. Create a new React project with TypeScript using CRA or Vite.

  2. Install @react-pdf/renderer.

  3. Import Document, Page, Text, and PDFViewer from @react-pdf/renderer.

  4. Render a simple PDF using <PDFViewer>

  5. Run npm start (CRA) or npm run dev (Vite).

  6. Open the browser and check the console.

Expected behavior The PDF should render inside the PDFViewer iframe (empty).

Image Image

Screenshots Image Image Image

Desktop (please complete the following information):

  • OS: Windows / Linux
  • Browser : Chrome / Zen Browser ( Firefox based )
  • React-pdf version 4.3.0

v3-Panwar-Ujjwal avatar Sep 08 '25 18:09 v3-Panwar-Ujjwal

+1

AlejandroRM-DEV avatar Sep 08 '25 18:09 AlejandroRM-DEV

+1

M-AhmedSajid avatar Oct 14 '25 15:10 M-AhmedSajid