Open DimaSmartBID opened 6 years ago
Same here...
Hi @DimaSmartBID and @danielrfranco Thanks for pointing it out. I'm not super active on my projects for last couple of months. I'll look into the issue.
According to this stackoverflow answer the error is related to babel.
I tried to copy the 3 files inside the src folder into my project and the error doesn't appear.
I solved it by copying all the files into my project with the following corrections:
pdfjs-dist
PDF
component import into index.js
Page
component import into pdf.js
pdf.js
import Page from './page';
PDFJS.GlobalWorkerOptions.workerSrc = //cdnjs.cloudflare.com/ajax/libs/pdf.js/${PDFJS.version}/pdf.worker.js
;
class PDF extends Component {
- inside `pdf.js` change `pdf.pdfInfo` into `pdf._pdfInfo`
- inside `pdf.js` change `Array(...{ length: numPages })` into `Array.from({ length: numPages) })`
It doesn't fix the library, but at least you can show the pages.
Hope this helps.
Hi, I receive this error: Module parse failed: Unexpected token (5:2) You may need an appropriate loader to handle this file type.
How can I fix this?