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.
This commit is contained in:
Jonas Jenwald 2020-10-25 14:42:46 +01:00
parent 126f42a266
commit d9084c0be2
2 changed files with 2 additions and 12 deletions
src/display
web

@ -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 (

@ -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());