Hi all,
I upgraded to pdfjs-dist 4.0.189 and changed *.js to *.mjs. The project compiles successfully, but I get this error in DevTools console:
pdf_viewer.mjs:3691 Uncaught (in promise) TypeError: Cannot destructure property 'AbortException' of 'globalThis.pdfjsLib' as it is undefined.
at pdf_viewer.mjs:3691:1
at ./node_modules/pdfjs-dist/legacy/web/pdf_viewer.mjs (pdf_viewer.mjs:11099:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:62:1)
at PdfReader.tsx:336:1
at __webpack_require__.a (async module:49:1)
at ./src/components/PdfReader/PdfViewer.tsx (PdfReader.tsx:336:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:62:1)
at src_components_PdfReader_PdfReader_tsx.chunk.js:25:68
The globalThis is window object but pdfjsLib is undefined.
Steps to reproduce the problem:
- upgrade to pdfjs-dist 4.0.189
- change
pdfjs.GlobalWorkerOptions.workerSrc = 'static/scripts/pdf.worker.min.js';
to
pdfjs.GlobalWorkerOptions.workerSrc = 'static/scripts/pdf.worker.min.mjs';
Hi all,
I upgraded to pdfjs-dist 4.0.189 and changed *.js to *.mjs. The project compiles successfully, but I get this error in DevTools console:
The
globalThisiswindowobject butpdfjsLibisundefined.Steps to reproduce the problem:
pdfjs.GlobalWorkerOptions.workerSrc = 'static/scripts/pdf.worker.min.js';
to
pdfjs.GlobalWorkerOptions.workerSrc = 'static/scripts/pdf.worker.min.mjs';