Pdf.js: Consider moving Webpack support to a separate package

Created on 18 Mar 2018  路  5Comments  路  Source: mozilla/pdf.js

I propose moving webpack.js to a separate package.
Why?

If someone is instaling pdf.js, while NOT using Webpack, they will see the following warnings:

warning "yourpackage > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0".
warning "yourpackage > pdfjs-dist > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "yourpackage > pdfjs-dist > worker-loader > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".

By doing so, we could get rid of worker-loader and webpack dependencies, making required download/build time/test time significantly smaller.

1-other

Most helpful comment

I believe the correct solution is outlined here: https://github.com/mozilla/pdf.js/issues/9733. webpack should not be a "peerDependency" at all.

All 5 comments

I believe the correct solution is outlined here: https://github.com/mozilla/pdf.js/issues/9733. webpack should not be a "peerDependency" at all.

@nfantone yes, I don't see any reason for webpack to be in "peerDependency", these are "devDependencies" only has nothing to do with module after it is distributed.

It is been 1 year+ not sure if there is any fix for it, it is not major, but it is not really something need big efforts to solve either, just removing webpack from the "peerDependency" is enough.

https://github.com/mozilla/pdfjs-dist/blob/master/package.json#L19

Given the discussion on IRC at https://mozilla.logbot.info/pdfjs/20180606#c14862530-c14862634 it looks like splitting off Webpack into a separate package is a better option, or perhaps even removing the Webpack bundling altogether. I'm personally not too familiar with Webpack bundling, but that's what I infer from the discussion.

@yurydelendik Do you have an opinion on this? The current situation is not ideal because of the peer dependency and removing that is also not ideal given that warnings will pop up (see #9248). Is there a particular reason to keep the Webpack example in there?

Do you really want worker-loader in dependencies?, maybe it should be in devDependencies, that's why you get another warning if you remove webpack from peers:
https://github.com/webpack-contrib/worker-loader/blob/master/package.json#L42

I see it is used here: https://github.com/mozilla/pdfjs-dist/blob/master/webpack.js#L18

This is the first time I see webpack published in distribution, for something should be working in the client side, as webpack as I know working for building the distribution not part of it.

Closing since the pull request above removed this dependencies altogether now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oddjobz picture oddjobz  路  46Comments

syssgx picture syssgx  路  29Comments

edwardmeng picture edwardmeng  路  31Comments

AliND picture AliND  路  29Comments

soa-x picture soa-x  路  174Comments