react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

react-pdf v6 Module parse failed: Unexpected character '#'

Open sabotag opened this issue 1 year ago • 3 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-PDF version
  • [X] I have checked if this bug is not already reported
  • [X] I have checked if an issue is not listed in Known issues
  • [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

Our team is waiting for a new version of react-pdf with a new build of pdfjs-dist, which has a fix for Hebrew, so for the test, we tried to install the 6th version of react-pdf but after installation we got the following error Screenshot 2022-08-29 at 14 16 25

Steps to reproduce

install react-pdf 16 or 17 react-scripts: 3.4.4 implement [email protected]

Expected behavior

Actual behavior

./node_modules/pdfjs-dist/build/pdf.js 1390:17
Module parse failed: Unexpected character '#' (1390:17)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| 
|         class PDFDocumentLoadingTask {
>           static #docId = 0;
| 
|           constructor() {

Additional information

how can we solve this problem? Thank you

DEMO

Environment

  • Browser (if applicable): chrome
  • React-PDF version: 6
  • React version: 17
  • react-scripts: 3.4.4

sabotag avatar Aug 29 '22 11:08 sabotag

Hmmm, tried running 6.0.0-beta.3 with my Create React App 5 sample app and it went without any issues. I suspect react-scripts 3.4.4 might be a bit too old 🤔

wojtekmaj avatar Sep 01 '22 07:09 wojtekmaj

Same issue here. As far as I am concerned react-scrits 3.x.x still seems to be pretty common these days and migrating to 4.x branch sometimes is not an option for any reason

Any chances to get some help with this?

quarryman avatar Sep 08 '22 19:09 quarryman

Maybe it's possible to update Babel manually? I hope they didn't pin Babel version in CRA?

wojtekmaj avatar Sep 12 '22 19:09 wojtekmaj