d53093045a
Given the amount of work put into removing `require`-calls from the code-base, let's ensure that new ones aren't accidentally added in the future. Note that we still have a couple of files where `require` is being used, in particular: - The Node.js examples, however those will be updated to use `import` in PR 17081. - The Webpack examples, and related support files, however I unfortunately don't know enough about Webpack to be able to update those. (Hopefully users of that code will help out here, once version `4` is released.) - The `statcmp`-tool, since *some* of those `require`-calls cannot be converted to `import` without other code changes (and that file is only used during benchmarking). Please find additional details at https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md
29 lines
921 B
JavaScript
29 lines
921 B
JavaScript
/* Copyright 2022 Mozilla Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* eslint-disable import/no-commonjs */
|
|
|
|
"use strict";
|
|
|
|
const pdfjs = require("./build/pdf.mjs");
|
|
|
|
if (typeof window !== "undefined" && "Worker" in window) {
|
|
pdfjs.GlobalWorkerOptions.workerPort = new Worker(
|
|
new URL("./build/pdf.worker.mjs", import.meta.url),
|
|
{ type: "module" }
|
|
);
|
|
}
|
|
|
|
module.exports = pdfjs;
|