1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

[api-minor] Use new Worker() syntax in webpack entrypoint

This requires Webpack 5 and will break for anyone using Webpack 4.
worker-loader no longer needs to be installed.
This commit is contained in:
Sam Magura 2022-09-12 21:40:58 -04:00
parent 493bb65005
commit 1c2d200918
3 changed files with 4 additions and 14 deletions

View file

@ -16,10 +16,11 @@
"use strict";
const pdfjs = require("./build/pdf.js");
const PdfjsWorker = require("worker-loader?esModule=false&filename=[name].[contenthash].js!./build/pdf.worker.js");
if (typeof window !== "undefined" && "Worker" in window) {
pdfjs.GlobalWorkerOptions.workerPort = new PdfjsWorker();
pdfjs.GlobalWorkerOptions.workerPort = new Worker(
new URL("./build/pdf.worker.js", import.meta.url)
);
}
module.exports = pdfjs;