Open tropicalraisel opened 3 years ago
What's the issue reported by Yarn 2?
@Kocal The error is logged as an "ambiguous error," since a dependent has a dependency that is not listed in the package.json
, such as webpack
.
But webpack
is a dependency of Encore. Are you saying that we will have to install all Encore dependencies manually because of Yarn 2?
Or am I missing something?
It's a little strange, and I don't understand it fully myself. My first ambiguous error encounter occurred after trying to add workbox-webpack-plugin
, and had to list webpack
in my package.json
to fix it. Another example is stylelint
wanting postcss-html
.
@Kocal the issue is that the project itself will be responsible for installing some of the webpack plugins, and they need to share the same webpack instance. I'm convinced that webpack
should be handled as a peer dependency instead (and also that all webpack plugins should have a peer dependency on webpack
instead of a dependency, for the same reason than Postcss did it in their version 8).
@stof thank for the explanation.
This is what I believe too, plugins and librairies for X
should not directly depends of X
but have a peer dependency to X
instead.
This would help to fix all the build warnings related to packages that have Webpack as a direct dependency. In Yarn 2, Webpack actually needs to be defined, otherwise it will crash.