diff --git a/example/webpack.config.js b/example/webpack.config.js index 339bee8..dc72b5f 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -49,11 +49,6 @@ module.exports = { test: new RegExp('node_modules/pdfjs-dist/build/pdf.worker.min.mjs'), type: 'asset/source', }, - { - // eslint-disable-next-line prefer-regex-literals - test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.min.mjs'), - type: 'asset/source', - }, ], }, plugins: [ diff --git a/src/PDFPreviewer.tsx b/src/PDFPreviewer.tsx index a36ab93..1d67d3c 100644 --- a/src/PDFPreviewer.tsx +++ b/src/PDFPreviewer.tsx @@ -1,7 +1,6 @@ // eslint-disable-next-line import/extensions import pdfWorkerSource from 'pdfjs-dist/build/pdf.worker.min.mjs'; // eslint-disable-next-line import/extensions -import pdfWorkerLegacySource from 'pdfjs-dist/legacy/build/pdf.worker.mjs'; import React, {memo, useCallback, useLayoutEffect, useRef, useState} from 'react'; import type {CSSProperties, ReactNode} from 'react'; import times from 'lodash/times'; @@ -15,7 +14,7 @@ import {pdfPreviewerStyles as styles} from './styles'; import PDFPasswordForm, {type PDFPasswordFormProps} from './PDFPasswordForm'; import PageRenderer from './PageRenderer'; import {PAGE_BORDER, LARGE_SCREEN_SIDE_SPACING, DEFAULT_DOCUMENT_OPTIONS, DEFAULT_EXTERNAL_LINK_TARGET, PDF_PASSWORD_FORM_RESPONSES} from './constants'; -import {isMobileSafari, isModernSafari, setListAttributes} from './helpers'; +import {setListAttributes} from './helpers'; type Props = { file: string; @@ -35,11 +34,7 @@ type Props = { type OnPasswordCallback = (password: string | null) => void; -const shouldUseLegacyWorker = isMobileSafari() && !isModernSafari(); -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const pdfWorker = shouldUseLegacyWorker ? pdfWorkerLegacySource : pdfWorkerSource; - -pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdfWorker], {type: 'text/javascript'})); +pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdfWorkerSource], {type: 'text/javascript'})); const DefaultLoadingComponent =
Loading...
; const DefaultErrorComponent =Failed to load the PDF file :(
; diff --git a/src/pdf.worker.d.ts b/src/pdf.worker.d.ts index ca34ffa..c636372 100644 --- a/src/pdf.worker.d.ts +++ b/src/pdf.worker.d.ts @@ -1,2 +1 @@ declare module 'pdfjs-dist/build/pdf.worker.min.mjs'; -declare module 'pdfjs-dist/legacy/build/pdf.worker.mjs';