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

Update webpack example #12815

Merged
merged 2 commits into from
Jan 7, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

  • Update the webpack-versions used in examples/webpack

    Once the next PDF.js release is made, the webpack example will no longer work since the non-translated builds now use ECMAScript features not supported by older webpack-versions.

  • Try to re-add the worker-loader package, in pdfjs-dist, using peerDependencies (PR 11474 follow-up)

    There's been a number of (somewhat) recent issues where people are having trouble using pdfjs-dist together with webpack, since that library purposely doesn't declare any dependencies; refer to PR [api-minor] Remove the Webpack-only npm dependencies from pdfjs-dist (PR 11418 follow-up) #11474 for additional context.

    In an attempt, although I don't know how much this will actually help in practice (given my limited webpack experience), let's try to list worker-loader as a peer-dependency to see if that helps. This should, unless I'm completely misunderstanding https://docs.npmjs.com/cli/v6/configuring-npm/package-json#peerdependencies, prevent worker-loader from being installed by default for all pdfjs-dist users while still indicating the dependency for those who need it.

Once the next PDF.js release is made, the `webpack` example will no longer work since the non-translated builds now use ECMAScript features not supported by older `webpack`-versions.
Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not really familiar with the concept of peer dependencies, but this suggestion has been made before, so I'm going to assume that this is correct. Did you check that this doesn't re-introduce #9248 for example?

…Dependencies` (PR 11474 follow-up)

There's been a number of (somewhat) recent issues where people are having trouble using pdfjs-dist together with `webpack`, since that library purposely doesn't declare any dependencies; refer to PR 11474 for additional context.

In an *attempt*, although I don't know how much this will actually help in practice (given my limited `webpack` experience), let's try to list `worker-loader` as a *peer*-dependency to see if that helps. This should, unless I'm completely misunderstanding https://docs.npmjs.com/cli/v6/configuring-npm/package-json#peerdependencies, prevent `worker-loader` from being installed by default for *all* pdfjs-dist users while still indicating the dependency for those who need it.
@Snuffleupagus Snuffleupagus force-pushed the update-webpack-example branch from af29f0a to 95f0f3b Compare January 6, 2021 10:02
@Snuffleupagus
Copy link
Collaborator Author

Did you check that this doesn't re-introduce #9248 for example?

I'm honestly not entirely sure how to do test this locally, unfortunately!
However, when that issue was filed worker-loader was listed as a regular dependency and now we only list it as a peer dependency which should hopefully help; so that exact problem shouldn't be re-introduced as far as I can tell.

@fdaveine
Copy link
Contributor

fdaveine commented Jan 7, 2021

@Snuffleupagus I was going to create a PR for #12813 but then I saw this PR, which is related to my issue, should I wait for this PR to be merged to create mine?

@Snuffleupagus
Copy link
Collaborator Author

should I wait for this PR to be merged to create mine?

As far as I can tell, you're not going to touch the same files and consequently there shouldn't be any conflicts (not that those are difficult to resolve anyway); hence I don't really see why you'd need to wait :-)

@timvandermeij timvandermeij merged commit 95e094c into mozilla:master Jan 7, 2021
@timvandermeij
Copy link
Contributor

Thank you!

@Snuffleupagus Snuffleupagus deleted the update-webpack-example branch January 7, 2021 21:36
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.

3 participants