Merge pull request #11081 from dhuang612/document-pdfjs-dist/webpack

added in information about pdfjs/webpack
This commit is contained in:
Tim van der Meij 2019-08-20 22:38:58 +02:00 committed by GitHub
commit 78f9ab53fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,3 +17,11 @@ http://localhost:8888/examples/webpack/index.html.
Refer to the `main.js` and `webpack.config.js` files for the source code. Refer to the `main.js` and `webpack.config.js` files for the source code.
Note that PDF.js packaging requires packaging of the main application and Note that PDF.js packaging requires packaging of the main application and
the worker code, and the `workerSrc` path shall be set to the latter file. 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:
import pdfjsLib from 'pdfjs-dist/webpack';
For a full working example refer to [this repository](https://github.com/yurydelendik/pdfjs-react).