From d9084c0be24dd4f829666bb2c45bd5d43eb5f180 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 25 Oct 2020 14:42:46 +0100 Subject: [PATCH] Load the fake worker, in non-`PRODUCTION` mode, with native async `import` This removes the last SystemJS usage from both the API and the default viewer. --- src/display/api.js | 7 +------ web/app.js | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index c6e7befb8..6cc2daa5f 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1746,12 +1746,7 @@ const PDFWorker = (function PDFWorkerClosure() { return mainWorkerMessageHandler; } if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) { - if (typeof SystemJS !== "object") { - // Manually load SystemJS, since it's only necessary for fake workers. - await loadScript("../node_modules/systemjs/dist/system.js"); - await loadScript("../systemjs.config.js"); - } - const worker = await SystemJS.import("pdfjs/core/worker.js"); + const worker = await import("pdfjs/core/worker.js"); return worker.WorkerMessageHandler; } if ( diff --git a/web/app.js b/web/app.js index fafb1d368..53a1bff38 100644 --- a/web/app.js +++ b/web/app.js @@ -2026,12 +2026,7 @@ async function loadFakeWorker() { GlobalWorkerOptions.workerSrc = AppOptions.get("workerSrc"); } if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) { - if (typeof SystemJS !== "object") { - // Manually load SystemJS, since it's only necessary for fake workers. - await loadScript("../node_modules/systemjs/dist/system.js"); - await loadScript("../systemjs.config.js"); - } - window.pdfjsWorker = await SystemJS.import("pdfjs/core/worker.js"); + window.pdfjsWorker = await import("pdfjs/core/worker.js"); return undefined; } return loadScript(PDFWorker.getWorkerSrc());