简体   繁体   中英

Reactjs - You may need an additional loader to handle the result of these loaders

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;
|

尝试使用最新版本的 pdfjs。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM