Merge pull request #12825 from fdaveine/worker-loader-missing-option-for-webpack-usage

An option is missing for last versions of worker-loader to use pdf.js with webpack
This commit is contained in:
Tim van der Meij 2021-01-07 22:22:16 +01:00 committed by GitHub
commit d8e42f7b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ the worker code, and the `workerSrc` path shall be set to the latter file.
If you are getting the `Setting up fake worker` warning, make sure you are
importing `pdfjs-dist/webpack` which is the zero-configuration method for
Webpack users. You will need to install
[worker-loader](https://github.com/webpack-contrib/worker-loader) as a
[worker-loader](https://github.com/webpack-contrib/worker-loader) (version 3.0.0 or higher is required), as a
dependency in your project in order to use `pdfjs-dist/webpack` (configuring
`worker-loader` is not necessary; just installing it is sufficient).

View File

@ -16,7 +16,7 @@
"use strict";
var pdfjs = require("./build/pdf.js");
var PdfjsWorker = require("worker-loader?esModule=false!./build/pdf.worker.js");
var PdfjsWorker = require("worker-loader?esModule=false&filename=[name].js!./build/pdf.worker.js");
if (typeof window !== "undefined" && "Worker" in window) {
pdfjs.GlobalWorkerOptions.workerPort = new PdfjsWorker();