1

After deleting the node module and yarn.lock I run yarn install and I dont know why i received this error, please help. Thanks

I used react js for this one.

./node_modules/pdfjs-dist/build/pdf.js 2119:34
Module parse failed: Unexpected token (2119:34)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js  
You may need an additional loader to handle the result of these loaders.
|           async destroy() {
|             this.destroyed = true;
>             await this._transport?.destroy();
|             this._transport = null;
|
Yuno
  • 89
  • 2
  • 10

2 Answers2

0

The general idea is to add async/await parsing support in babel.

Try this in your babel config file:

"plugins": [
  "@babel/plugin-transform-runtime",
...
],

Ref:

babel doesn't parse async await

waltermitty
  • 453
  • 3
  • 12
-2

Try using the newest version of pdfjs.

Jun Tang
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 15 '22 at 03:25