我的反应应用程序中有pdfjs-dist
依赖项,但它不工作 - 我不确定我改变了什么导致这种情况。我正在跑步node v14.16.1
, npm v7.9.0
, react 17.0.2
, react-scripts 4.0.3
, 和pdfjs-dist 2.7.570
. 我在运行时收到以下错误消息npm start
:
Failed to compile.
./node_modules/pdfjs-dist/build/pdf.js 2407:53
Module parse failed: Unexpected token (2407:53)
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.
| intent: renderingIntent,
| renderInteractiveForms: renderInteractiveForms === true,
> annotationStorage: annotationStorage?.getAll() || null
| });
| }
我已经尝试卸载并重新安装相关软件包,以及npm update
,npm audit
等等。我也尝试添加worker-loader
npm 包,但它已经是对 pdfjs-dist 的对等依赖,所以它没有任何区别。我在这个项目上的合作伙伴有相同的回购,他没有任何问题,所以我确信这是我的目标。我相信这与对可选链接的支持有关,但不确定如何进行。谢谢!