mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Reduce usage of SystemJS, in the development viewer, even further
With these changes SystemJS is now only used, during development, on the worker-thread and in the unit/font-tests, since Firefox is currently missing support for worker modules; please see https://bugzilla.mozilla.org/show_bug.cgi?id=1247687 Hence all the JavaScript files in the `web/` and `src/display/` folders are now loaded *natively* by the browser (during development) using standard `import` statements/calls, thanks to a nice `import-maps` polyfill. *Please note:* As soon as https://bugzilla.mozilla.org/show_bug.cgi?id=1247687 is fixed in Firefox, we should be able to remove all traces of SystemJS and thus finally be able to use every possible modern JavaScript feature.
This commit is contained in:
parent
a5c60cdd31
commit
8d56a69e74
10 changed files with 49 additions and 16 deletions
13
src/core/.eslintrc
Normal file
13
src/core/.eslintrc
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017,
|
||||
},
|
||||
|
||||
"extends": [
|
||||
"../../.eslintrc"
|
||||
],
|
||||
|
||||
"env": {
|
||||
"es2017": true,
|
||||
},
|
||||
}
|
|
@ -1650,7 +1650,9 @@ const PDFWorker = (function PDFWorkerClosure() {
|
|||
}
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
|
||||
if (typeof SystemJS !== "object") {
|
||||
throw new Error("SystemJS must be used to load fake worker.");
|
||||
// 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");
|
||||
return worker.WorkerMessageHandler;
|
||||
|
|
|
@ -65,8 +65,8 @@ const pdfjsBuild =
|
|||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
|
||||
const streamsPromise = Promise.all([
|
||||
SystemJS.import("pdfjs/display/network.js"),
|
||||
SystemJS.import("pdfjs/display/fetch_stream.js"),
|
||||
import("pdfjs/display/network.js"),
|
||||
import("pdfjs/display/fetch_stream.js"),
|
||||
]);
|
||||
setPDFNetworkStreamFactory(params => {
|
||||
return streamsPromise.then(streams => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue