From 8a17bd7c4b72a5c08c9b4053d18248a1e6539496 Mon Sep 17 00:00:00 2001 From: Tomasz Lesniakiewicz Date: Tue, 17 Dec 2024 15:22:40 +0100 Subject: [PATCH 1/2] use only modern pdf worker for pdfjs lib --- config/webpack/webpack.common.ts | 2 +- src/components/PDFThumbnail/index.tsx | 2 +- src/types/modules/pdf.worker.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/webpack/webpack.common.ts b/config/webpack/webpack.common.ts index c60670c72324..ac086d3a9bed 100644 --- a/config/webpack/webpack.common.ts +++ b/config/webpack/webpack.common.ts @@ -175,7 +175,7 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment): // We are importing this worker as a string by using asset/source otherwise it will default to loading via an HTTPS request later. // This causes issues if we have gone offline before the pdfjs web worker is set up as we won't be able to load it from the server. { - test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.min.mjs'), + test: new RegExp('node_modules/pdfjs-dist/build/pdf.worker.min.mjs'), type: 'asset/source', }, diff --git a/src/components/PDFThumbnail/index.tsx b/src/components/PDFThumbnail/index.tsx index 495c14ff76e1..6b83afe603c1 100644 --- a/src/components/PDFThumbnail/index.tsx +++ b/src/components/PDFThumbnail/index.tsx @@ -1,6 +1,6 @@ import 'core-js/proposals/promise-with-resolvers'; // eslint-disable-next-line import/extensions -import pdfWorkerSource from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs'; +import pdfWorkerSource from 'pdfjs-dist/build/pdf.worker.min.mjs'; import React, {useMemo, useState} from 'react'; import {View} from 'react-native'; import {Document, pdfjs, Thumbnail} from 'react-pdf'; diff --git a/src/types/modules/pdf.worker.d.ts b/src/types/modules/pdf.worker.d.ts index a6d70e529b7f..c636372b411d 100644 --- a/src/types/modules/pdf.worker.d.ts +++ b/src/types/modules/pdf.worker.d.ts @@ -1 +1 @@ -declare module 'pdfjs-dist/legacy/build/pdf.worker.min.mjs'; +declare module 'pdfjs-dist/build/pdf.worker.min.mjs'; From fa081259fd83f209ddd75161534253c056e546ea Mon Sep 17 00:00:00 2001 From: Tomasz Lesniakiewicz Date: Thu, 19 Dec 2024 12:14:21 +0100 Subject: [PATCH 2/2] update react-fast-pdf version --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6111bcc702c9..9ba2983addbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,7 @@ "react-content-loader": "^7.0.0", "react-dom": "18.3.1", "react-error-boundary": "^4.0.11", - "react-fast-pdf": "1.0.20", + "react-fast-pdf": "1.0.21", "react-map-gl": "^7.1.3", "react-native": "0.75.2", "react-native-android-location-enabler": "^2.0.1", @@ -31747,9 +31747,9 @@ } }, "node_modules/react-fast-pdf": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/react-fast-pdf/-/react-fast-pdf-1.0.20.tgz", - "integrity": "sha512-E2PJOO5oEqi6eNPllNOlQ8y0DiLZ3AW8t+MCN7AgJPp5pY04SeDveXHWvPN0nPU4X5sRBZ7CejeYce2QMMQDyg==", + "version": "1.0.21", + "resolved": "https://registry.npmjs.org/react-fast-pdf/-/react-fast-pdf-1.0.21.tgz", + "integrity": "sha512-8Uuz/jPHjHqElH+aUj3ldS/Hg/NoZ5ZS/VupGzDkVJST0UiGzxkvDxxFIQuYuiaI4NGwGmqtQGGYsjJKpyWnig==", "license": "MIT", "dependencies": { "react-pdf": "^9.1.1", diff --git a/package.json b/package.json index 5c76d43e1ed4..9a013899f2f1 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "react-content-loader": "^7.0.0", "react-dom": "18.3.1", "react-error-boundary": "^4.0.11", - "react-fast-pdf": "1.0.20", + "react-fast-pdf": "1.0.21", "react-map-gl": "^7.1.3", "react-native": "0.75.2", "react-native-android-location-enabler": "^2.0.1",