Merge pull request #11964 from aplum/fix-webpack-import

Fix pdfjs-dist/webpack causing errors with certain configs
This commit is contained in:
Tim van der Meij 2020-06-04 23:56:49 +02:00 committed by GitHub
commit 7aa1b2d418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -20,7 +20,12 @@ the worker code, and the `workerSrc` path shall be set to the latter file.
## Worker loading
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:
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
dependency in your project in order to use `pdfjs-dist/webpack` (configuring
`worker-loader` is not necessary; just installing it is sufficient).
import pdfjsLib from 'pdfjs-dist/webpack';

View File

@ -15,14 +15,6 @@
"use strict";
try {
require.resolve("worker-loader");
} catch (ex) {
throw new Error(
"Cannot find the `worker-loader` package, please make sure that it's correctly installed."
);
}
var pdfjs = require("./build/pdf.js");
var PdfjsWorker = require("worker-loader!./build/pdf.worker.js");