You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
How to fix this. when run react I found error.
./node_modules/pdfjs-dist/build/pdf.js 3454:145
Module parse failed: Unexpected token (3454:145)
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.
| numPages: this._numPages,
| annotationStorage: (annotationStorage === null || annotationStorage === void 0 ? void 0 : annotationStorage.serializable) || null,
The below solution works for me
First, install
npm install npm-force-resolutions --save-dev
Then in package.json we need to override the pdfjs-dist version to previous working version like this
"dependencies": {
"pdf-viewer-reactjs": "2.2.3",
}.
"scripts": {
"preinstall": "npx npm-force-resolutions"
},
"resolutions": {
"pdfjs-dist": "2.6.347"
}
and in scripts section add new preinstall entry:
"preinstall": "npx npm-force-resolutions",
now if you do npm install and run your application it should work. Hope it helps
The root cause of the problem is , though in the dependency package.json has version 2.6.347 for pdfjs-dist since ^ was there before the version number during npm install, it installs the most recent version of pdfjs-dist which is causing this problem.
Describe the bug
How to fix this. when run react I found error.
./node_modules/pdfjs-dist/build/pdf.js 3454:145
Module parse failed: Unexpected token (3454:145)
File was processed with these loaders:
You may need an additional loader to handle the result of these loaders.
| numPages: this._numPages,
| annotationStorage: (annotationStorage === null || annotationStorage === void 0 ? void 0 : annotationStorage.serializable) || null,
| }).finally(() => {
| if (annotationStorage) {
How to Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Please add screenshots to help explain your problem.
PDF File
Please attach the pdf file.
Details (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: