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:
parent
493bb65005
commit
1c2d200918
3 changed files with 4 additions and 14 deletions
5
external/dist/webpack.js
vendored
5
external/dist/webpack.js
vendored
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue