Skip to content

Commit 02b9571

Browse files
authored
fix: disable worker for all env for issue #68 and #396 (#398)
1 parent 364f30c commit 02b9571

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"build:rollup": "rollup -c ./rollup.config.js",
5353
"build:bundle-pdfjs-base": "node rollup/bundle-pdfjs-base.js",
5454
"build": "npm run build:bundle-pdfjs-base && npm run build:rollup",
55-
"build:clean": "rm -rf node_modules && rm -f package-lock.json && npm i && npm run build"
55+
"build:clean": "rm -rf node_modules && rm -f package-lock.json && npm i && npm run build",
56+
"test:deno": "deno --allow-read --allow-write --allow-net --allow-env --no-check ./bin/pdf2json.js -f ./test/pdf/fd/form/ -o ./test/target/fd/form -t -c -m -r",
57+
"test:bun": "bun ./bin/pdf2json.js -f ./test/pdf/fd/form/ -o ./test/target/fd/form -t -c -m -r"
5658
},
5759
"engines": {
5860
"node": ">=20.18.0"

rollup/bundle-pdfjs-base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ const _baseCode = _pdfjsFiles.reduce(
6565
fs.writeFileSync(path.join(__dirname, "../lib/pdfjs-code.js"),
6666
`
6767
${"import nodeUtil from 'node:util';import { Blob } from 'node:buffer';import { DOMParser } from './simpleXmlParser.js';import PDFAnno from './pdfanno.js';import Image from './pdfimage.js';import { createScratchCanvas } from './pdfcanvas.js';"}
68-
${"export const PDFJS = {};"}
69-
${"const globalScope = { console };"}
68+
${"export const PDFJS = { disableWorker: true };"}
69+
${"const globalScope = { console, PDFJS };"}
7070
${_baseCode}
7171
`,
7272
{

0 commit comments

Comments
 (0)