Skip to content

Conversation

@merceyz
Copy link
Contributor

@merceyz merceyz commented Jul 17, 2020

Webpack tries to require webpack-cli without declaring it as a optional peer dependency which causes it to not get access to it under Yarn PnP

Fixes half of yarnpkg/berry#1452

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
No

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?
N/A

@jsf-clabot
Copy link

jsf-clabot commented Jul 17, 2020

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@alexander-akait
Copy link
Member

alexander-akait commented Jul 17, 2020

Webpack doesn't use webpack-cli I am wrong

@merceyz
Copy link
Contributor Author

merceyz commented Jul 17, 2020

It does actually, it tries to require it in these locations

require.resolve(packageName);

require(cli.package); //eslint-disable-line

const pkgPath = require.resolve(`${cli.package}/package.json`);

@sokra
Copy link
Member

sokra commented Jul 17, 2020

Is it allowed to use peerDependenciesMeta without using peerDependencies?

@merceyz
Copy link
Contributor Author

merceyz commented Jul 17, 2020

Yes, Yarn 2 and potentially pnpm will treat it as if you also specified

"peerDependencies": {
  "webpack-cli": "*"
}

Yarn 1 and probably npm will just ignore it

@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@alexander-akait
Copy link
Member

@arcanis
Copy link

arcanis commented Jul 17, 2020

Yep! 👍

@sokra sokra merged commit 6223b1c into webpack:master Jul 20, 2020
@sokra
Copy link
Member

sokra commented Jul 20, 2020

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants