question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v6] Module parse failed: Unexpected character '#' when using Create-React-App

See original GitHub issue

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • 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 react-pdf@v6.0.0-beta.3

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
wojtekmajcommented, Dec 14, 2022

Legacy builds were dropped in #988. One of the main reasons was that this made the code insanely big and this kept crashing people’s machines due to out of memory errors.

1reaction
veddermaticcommented, Nov 23, 2022

Another data point; I’m seeing this with:

"react-scripts": "^4.0.3",
"react": "^16.12.0",
"react-pdf": "^6.2.0",
"typescript": "^4.2.4",
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Module parse failed: Unexpected character '@'
I write the webpack.config.dev.js file like below: ... fallback: 'style-loader', use: [ // "postcss" loader applies autoprefixer to our CSS.
Read more >
[Solved]-Module parse failed: Unexpected character '@' when ...
Coding example for the question Module parse failed: Unexpected character '@' when using React on Rails with Antd.-Reactjs.
Read more >
039;t build with webpack - Material Design for Bootstrap
css 1:0 Module parse failed: Unexpected character '@' (1:0) You may need an appropriate loader to handle this file type, currently no loaders...
Read more >
webpack/webpack - Gitter
I'm using module federation and promised based dynamic remotes (https://webpack.js.org/concepts/module-federation/#promise-based-dynamic-remotes). Everything is ...
Read more >
Troubleshooting | React Navigation
If the module points to an npm package (i.e. the name of the module doesn't with ./ ), then it's probably due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found