[api-minor] Remove the Webpack-only npm dependencies from pdfjs-dist
(PR 11418 follow-up)
#11474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently all users of
pdfjs-dist
are forced to install thewebpack
andworker-loader
packages, despite the fact that they are only relevant if thewebpack.js
file is being used (with a custom Webpack build).This really doesn't seem great, especially since those packages are the only remaining dependencies in the
pdfjs-dist
library, and it thus seem more reasonable overall that Webpack users handle those dependencies themselves.To prevent unnecessarily cryptic runtime failures, when people update to newer
pdfjs-dist
versions, thewebpack.js
file was updated to explicitly check for the existence of theworker-loader
package and error otherwise.Furthermore, note that
webpack
was only listed as a dependency because of theworker-loader
package itself (see issue 9248).Obviously these changes may not be seen as great by Webpack users who rely on
pdfjs-dist
, since it forces them to handle the dependencies themselves, however it should improve things considerably for "general" users ofpdfjs-dist
by not burdening them with unnecessary dependencies.These sort of changes are also in line with other recent changes, see PR #11418, which removed built-in fake worker loader code for specific JS builders/bundlers/frameworks. This work was prompted not only by a desire to simplify/clean-up old code, but also to lessen future support burden since the PDF.js contributors cannot be assumed to be experts in various JS bundlers.
Given that I cannot image any PDF.js contributor being keen on maintaining/supporting a separate library and npm package, similar to
pdfjs-dist
, with proper built-in Webpack support; I'm thus suggesting that this PR is probably the easiest way to fix #9580.