#2039·react-pdf

pdfjs-dist - DOMMatrix is not defined in the next-pages sample

Author: cyrillefCreated Nov 23, 2025Updated Mar 12, 2026
Labelsbugfresh

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

This is a follow-up on issue #1999. I extracted the next-pages/ sample located at 'https://github.com/wojtekmaj/react-pdf/tree/main/sample/next-pages' I ran npm install npm install --save typescript react-pdf npm install --save-dev @types/node @types/react npm run build

[email protected] build next build

⚠ The "experimental.esmExternals" option has been modified. experimental.esmExternals is not recommended to be modified as it may disrupt module resolution. It should be removed from your next.config.ts. ▲ Next.js 15.5.6

  • Experiments (use with caution): · esmExternals: "loose" · extensionAlias

✓ Linting and checking validity of types Creating an optimized production build ... ✓ Compiled successfully in 431ms Collecting page data ..Warning: Please use the legacy build in Node.js environments. [ReferenceError: DOMMatrix is not defined]

Build error occurred [Error: Failed to collect page data for /Sample] { type: 'Error' }

Steps to reproduce

instructions present in the description

Expected behavior

Build and Run works as documented

Actual behavior

Failed in npm run build

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Bundler name and version (if applicable):