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

Should use peerDependenciesMeta for worker-loader #13825

Closed
tamuratak opened this issue Jul 30, 2021 · 4 comments · Fixed by #13833
Closed

Should use peerDependenciesMeta for worker-loader #13825

tamuratak opened this issue Jul 30, 2021 · 4 comments · Fixed by #13833
Labels

Comments

@tamuratak
Copy link
Contributor

Related to #11474 and #12815.

The following should be added to package.json of pdfjs-dist for worker-loader.

  "peerDependenciesMeta": {
    "worker-loader": {
      "optional": true
    }
  }

npm v7 installs peerDependencies by default. We can see that calling npm install pdfjs-dist in an empty directory will install webpack and others in node_modules.

In npm versions 3 through 6, peerDependencies were not automatically installed, and would raise a warning if an invalid version of the peer dependency was found in the tree. As of npm v7, peerDependencies are installed by default.

We can make worker-loader optional with peerDependenciesMeta.

@Snuffleupagus
Copy link
Collaborator

The following should be added to package.json of pdfjs-dist for worker-loader.

  "peerDependenciesMeta": {
    "worker-loader": {
      "optional": true
    }
  }

@tamuratak That looks completely reasonable as far as I can tell; do you want to submit a patch?
The new code should be added just after the following block (since the package.json file is generated):

pdf.js/gulpfile.js

Lines 2020 to 2022 in 3ec1bac

peerDependencies: {
"worker-loader": "^3.0.7", // Used in `external/dist/webpack.js`.
},

Also, if we're editing this code anyway I'd suggest bumping the worker-loader package to use version ^3.0.8 as well.

@synedra-mpe
Copy link

synedra-mpe commented Oct 25, 2021

Can someone please trigger a release of pdfjs-dist v2.11.338 on npmjs.com to make use of these fixes?

@Snuffleupagus
Copy link
Collaborator

Can someone please trigger a release of pdfjs-dist v2.11.338 on npmjs.com to make use of these fixes?

See https://www.npmjs.com/package/pdfjs-dist?activeTab=versions

@synedra-mpe
Copy link

Thanks a lot for pointing me to the ricght direction. yarn add pdfjs-dist@next worked.

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.

4 participants