wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.11k stars 867 forks source link

Broken in pdfjs-dist 4.0.189 #1660

Closed mashirozx closed 9 months ago

mashirozx commented 9 months ago

Before you start - checklist

Description

they are now using mjs in their build, which results in error.

Steps to reproduce

pdfjs.GlobalWorkerOptions.workerSrc = new URL(
    'pdfjs-dist/build/pdf.worker.min.mjs',
    import.meta.url,
  ).toString();

Expected behavior

should load the worker normally

Actual behavior

the browser complains about the mjs module

Additional information

No response

Environment

wojtekmaj commented 9 months ago

You should not use another pdfjs-dist version than the one that comes with React-PDF.

With pdfjs-dist hitting 4.0 it's obvious some breaking changes are expected, but unfortunately Mozilla was notoriously not adhering to semver and introducing breaking changes in minor updates, therefore pdfjs-dist version is locked at a specific version.

Fear not though, we'll catch up!