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

I cant use package in Nextjs 14 #1682

Closed IkboljonMe closed 7 months ago

IkboljonMe commented 7 months ago

Before you start - checklist

Description

I followed exact steps. It is working in react app, but in Next.js it is not. I used older version like x5, it is the same. In console, it is saying "Content-Security-Policy: The page’s settings blocked the loading of a resource at http://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.12.313/pdf.worker.min.js (“script-src”). page.js line 2548 > eval:694:48" I use older version and the cnd link is pdfjs.GlobalWorkerOptions.workerSrc =//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js` But if I use newer version, I cant even set fake web worker. If I use new urlParam , it is throwing url.funtion type error. I dont know what to do, I am stucked in this problem last two day. I dont know this is bug or not. Thank you in advance

Steps to reproduce

I have blog project. I cant set up react-pdf in my repo

Expected behavior

It should not be so problematic as in react app.

Actual behavior

Loading failed for the Githubissues.

  • Githubissues is a development platform for aggregating issues.