Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack instructions can't work with last worker-loader versions #12813

Closed
fdaveine opened this issue Jan 4, 2021 · 2 comments · Fixed by #12825
Closed

webpack instructions can't work with last worker-loader versions #12813

fdaveine opened this issue Jan 4, 2021 · 2 comments · Fixed by #12825
Labels

Comments

@fdaveine
Copy link
Contributor

fdaveine commented Jan 4, 2021

I followed the recommendations given here to use pdf.js 2.6.347 with webpack.

It mention that:

...(configuring worker-loader is not necessary; just installing it is sufficient).

It's no longer the case with the last version of worker-loader (v3.0.7), and since the version v3.0.0 I believe, due to a breaking change in this package:

image

The filename option now default to [name].worker.js, which cause webpack to generate a pdf.worker.worker.js file instead of the expected pdf.worker.js.

To make webpack generate the proper file, I had to update a line inside /external/dist/webpack.js as mention bellow:

var PdfjsWorker = require("worker-loader?esModule=false&filename=[name].js!pdfjs-dist/build/pdf.worker.js");

(I added &filename=[name].js option, for worker-loader not to add its new suffix)

@fdaveine
Copy link
Contributor Author

fdaveine commented Jan 4, 2021

Let me know if it would be helpful that I make a PR for this.

@timvandermeij
Copy link
Contributor

A PR for this would be very welcome, most likely together with a small change to the README file to say that at least worker-loader version 3.0.0 or higher is required now; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants