We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
My code:
"use client"; import React, { useEffect } from "react"; import { Document, pdfjs } from "react-pdf"; pdfjs.GlobalWorkerOptions.workerSrc = "/pdf.worker.mjs"; export default function PDFTest() { return ( <div> <Document file="https://arxiv.org/pdf/2304.14211" /> </div> ); }
pnpm i react-pdf
./public
PDF view works
./node_modules/.pnpm/pdfjs-dist@4.4.168/node_modules/pdfjs-dist/build/pdf.mjs:11881:28 Module not found 11879 | return this.#mainThreadWorkerMessageHandler; 11880 | } > 11881 | const worker = await import( /*webpackIgnore: true*/this.workerSrc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11882 | return worker.WorkerMessageHandler; 11883 | };
I tried deleting .next but that didn't help either.
.next
next dev --turbo
The text was updated successfully, but these errors were encountered:
I had an issue while importning the worker. Here's what I did.
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.mjs`;
I guess you could just download that file and put it in the public folder. Should fix it
Sorry, something went wrong.
I had an issue while importning the worker. Here's what I did. pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.mjs`; I guess you could just download that file and put it in the public folder. Should fix it
I also added it manually, but I hope it could be fixed here
No branches or pull requests
Before you start - checklist
Description
My code:
Steps to reproduce
pnpm i react-pdf
./public
Expected behavior
PDF view works
Actual behavior
Additional information
I tried deleting
.next
but that didn't help either.Environment
next dev --turbo
The text was updated successfully, but these errors were encountered: