Skip to content

Commit 69ecd47

Browse files
committed
Fix bug where PDFJS and globalScope.PDFJS were different objects
1 parent 3d7f2b9 commit 69ecd47

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

base/display/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ PDFJS.imageResourcesPath = PDFJS.imageResourcesPath === undefined ?
4949
/**
5050
* Disable the web worker and run all code on the main thread. This will happen
5151
* automatically if the browser doesn't support workers or sending typed arrays
52-
* to workers.
52+
* to workers. Default is true when running in a server environment like node or bun.
5353
* @var {Boolean}
5454
*/
5555
PDFJS.disableWorker = PDFJS.disableWorker === undefined ?
56-
false : PDFJS.disableWorker;
56+
typeof window === 'undefined' : PDFJS.disableWorker;
5757

5858
/**
5959
* Path and filename of the worker file. Required when the worker is enabled in

rollup/bundle-pdfjs-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fs.writeFileSync(path.join(__dirname, "../lib/pdfjs-code.js"),
6666
`
6767
${"import nodeUtil from 'util';import { Blob } from 'buffer';import { DOMParser } from '@xmldom/xmldom';import PDFAnno from './pdfanno.js';import Image from './pdfimage.js';import { createScratchCanvas } from './pdfcanvas.js';"}
6868
${"export const PDFJS = {};"}
69-
${"const globalScope = { console };"}
69+
${"const globalScope = { console, PDFJS };"}
7070
${_baseCode}
7171
`,
7272
{

0 commit comments

Comments
 (0)