Skip to content

Commit e057968

Browse files
committed
Only import the necessary
Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent ba5a02b commit e057968

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils/asyncReader.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import * as pdfjsLib from 'pdfjs-dist'
2-
pdfjsLib.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker')
1+
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist'
2+
import * as pdfjsWorker from 'pdfjs-dist/build/pdf.worker'
3+
GlobalWorkerOptions.workerSrc = pdfjsWorker
34

45
/**
56
*
@@ -51,5 +52,5 @@ export function readAsDataURL(file) {
5152
* @param file
5253
*/
5354
export async function readAsPDF(file) {
54-
return pdfjsLib.getDocument(file).promise
55+
return getDocument(file).promise
5556
}

0 commit comments

Comments
 (0)