DanielArnould / react-pdf-highlighter-extended

📄 Set of modern React components for PDF highlighting
https://danielarnould.github.io/react-pdf-highlighter-extended/example-app/
MIT License
43 stars 16 forks source link

Update pdfjs-dist version #8

Closed beardedphil closed 1 month ago

beardedphil commented 3 months ago

Older versions refer to an outdated version of pdfjs which contains a high severity vulnerability.

DanielArnould commented 1 month ago

Resolved in v8.1.0

yixuanL commented 1 month ago

Thanks a lot for the update!

I am using javascript in my project. After this update I am receiving the following errors

ERROR in ./node_modules/react-pdf-highlighter-extended/dist/esm/index.js 8:0-76
Module not found: Error: Can't resolve './contexts/PdfHighlighterContext' in '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/dist/esm'
Did you mean 'PdfHighlighterContext.js'?
BREAKING CHANGE: The request './contexts/PdfHighlighterContext' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/react-pdf-highlighter-extended/dist/esm/index.js 10:0-24
Module not found: Error: Can't resolve './types' in '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/dist/esm'
Did you mean 'types.js'?
BREAKING CHANGE: The request './types' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

I tried to add .js to the file locations in ./node_modules/react-pdf-highlighter-extended/dist/esm/index.js but it didn't work. Any suggestions?

Thanks a lot! :)


I installed again your 8.0.0 version, and realised there was some warnings regarding javascript typescript incompatblity already: e.g.

WARNING in ./node_modules/react-pdf-highlighter-extended/dist/esm/lib/optimize-client-rects.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/optimize-client-rects.ts' file: Error: ENOENT: no such file or directory, open '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/optimize-client-rects.ts'

WARNING in ./node_modules/react-pdf-highlighter-extended/dist/esm/lib/pdfjs-dom.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/pdfjs-dom.ts' file: Error: ENOENT: no such file or directory, open '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/pdfjs-dom.ts'

WARNING in ./node_modules/react-pdf-highlighter-extended/dist/esm/lib/screenshot.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/screenshot.ts' file: Error: ENOENT: no such file or directory, open '/home/ubuntu/DocInsights/AML/services/frontend/node_modules/react-pdf-highlighter-extended/src/lib/screenshot.ts'

which might explain my other issue, why only 3 pages of the whole PDF file are loaded and rendered