mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Use non-legacy build of PDF.js
GitOrigin-RevId: 473dc8657bac01fc4fc7b94565b10ff939e7fcdd
This commit is contained in:
parent
a457c611c8
commit
17e8c70069
3 changed files with 5 additions and 10 deletions
|
@ -41,7 +41,7 @@ const buildConfig = () => {
|
|||
)
|
||||
|
||||
// add entrypoints under '/' for pdfjs workers
|
||||
addWorker('pdfjs-dist', 'pdfjs-dist/legacy/build/pdf.worker.mjs')
|
||||
addWorker('pdfjs-dist', 'pdfjs-dist/build/pdf.worker.mjs')
|
||||
|
||||
return webpackConfig
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import {
|
|||
EventBus,
|
||||
PDFLinkService,
|
||||
LinkTarget,
|
||||
} from 'pdfjs-dist/legacy/web/pdf_viewer.mjs'
|
||||
import 'pdfjs-dist/legacy/web/pdf_viewer.css'
|
||||
} from 'pdfjs-dist/web/pdf_viewer.mjs'
|
||||
import 'pdfjs-dist/web/pdf_viewer.css'
|
||||
|
||||
const DEFAULT_RANGE_CHUNK_SIZE = 128 * 1024 // 128K chunks
|
||||
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
import 'core-js/stable/global-this' // polyfill for globalThis (used by pdf.js)
|
||||
import 'core-js/stable/promise/all-settled' // polyfill for Promise.allSettled (used by pdf.js)
|
||||
import 'core-js/stable/structured-clone' // polyfill for global.StructuredClone (used by pdf.js)
|
||||
import 'core-js/stable/array/at' // polyfill for Array.prototype.at (used by pdf.js)
|
||||
|
||||
import { createWorker } from '@/utils/worker'
|
||||
import * as PDFJS from 'pdfjs-dist/legacy/build/pdf.mjs'
|
||||
import * as PDFJS from 'pdfjs-dist'
|
||||
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api'
|
||||
|
||||
export { PDFJS }
|
||||
|
||||
createWorker(() => {
|
||||
PDFJS.GlobalWorkerOptions.workerPort = new Worker(
|
||||
new URL('pdfjs-dist/legacy/build/pdf.worker.mjs', import.meta.url) // NOTE: .mjs extension
|
||||
new URL('pdfjs-dist/build/pdf.worker.mjs', import.meta.url) // NOTE: .mjs extension
|
||||
)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue