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

[api-minor] Remove the Webpack-only npm dependencies from pdfjs-dist (PR 11418 follow-up) #11474

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Jan 5, 2020

Currently all users of pdfjs-dist are forced to install the webpack and worker-loader packages, despite the fact that they are only relevant if the webpack.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, the webpack.js file was updated to explicitly check for the existence of the worker-loader package and error otherwise.
Furthermore, note that webpack was only listed as a dependency because of the worker-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 of pdfjs-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.

…` (PR 11418 follow-up)

Currently *all* users of `pdfjs-dist` are forced to install the `webpack` and `worker-loader` packages, despite the fact that they are *only* relevant if the `webpack.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, the `webpack.js` file was updated to explicitly check for the existence of the `worker-loader` package and error otherwise.
Furthermore, note that `webpack` was only listed as a dependency because of the `worker-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 of `pdfjs-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.
@timvandermeij timvandermeij merged commit 3772e30 into mozilla:master Jan 6, 2020
@timvandermeij
Copy link
Contributor

Given the number of likes on that issue and given the fact that we want to reduce the amount of maintenance for the various bundler solutions, this seems like the easiest solution to me as well and should benefit most users. Thanks!

@Snuffleupagus Snuffleupagus deleted the pdfjs-dist-rm-dependencies branch January 6, 2020 22:57
@Snuffleupagus
Copy link
Collaborator Author

Looking at open issue related to Webpack, it seems that they're either "fixed" by this PR or basically support requests related to Webpack bundling/usage (given that no current PDF.js contributors seem to have much Webpack knowledge/experience it seems unlikely that they'll ever be "officially" answered).

All in all, is it actually meaningful to keep those issues open?

@timvandermeij
Copy link
Contributor

Not really. I'll go over them and close them if they are not actionable.

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 this pull request may close these issues.

Consider moving Webpack support to a separate package
2 participants