-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Not possible to use encore without warnings #448
Comments
I've thought a lot about this, and I also dislike these errors. But, it's tricky. We're not a true peer dependency - we really are calling webpack directly from our CLI tool and requiring it directly. On the link you listed, we sorta satisfy both sides of the simple rule. For that reason, I originally decided to make webpack a true dependency. This also simplifies what the user needs to have in their package.json file. I don't feel a lot of motivation to change it, until/unless it starts causing concrete problem. Cheers! |
if you read the message closely it meantions peer dependency. So all yarn really wants is for you to do this, basically: ‘yarn add -P webpack’ Yarn is then satisfied and it won’t overwrite the existing webpack configuration That’s a short term fix. I think Encore should make these optional dependencies From my limited (and admittedly not deep) testing it worked for me. https://yarnpkg.com/lang/en/docs/dependency-types/ If you’re not publishing a Frontend library it should have no adverse effects |
@ProtonScott I don't think that's right either since it would mean that the app/lib you are working on depends on Webpack being installed (which is probably not the case). As @mmarton said, if we wanted to be semantically correct the peer-dependency should be declared in Encore's |
I see your points. It's just having warnings as the expected behavior is just makes an unprofessional impression. Not something I would expect from an official symfony tool. |
This is currently still a thing. Maybe the warning should mention that you can solve this by adding Webpack as peer dependency to your project? |
Yeah but when you do that Encore tells you to avoid adding webpack to your package list... |
I was able to suppress this warning by adding the following to my project's package.json file:
This does seem to fix the installed version of webpack to the version specified though. |
I also managed to solve it temporarily by checking the used webpack version inside encore (for me ^4.20.0) and manually setting the
|
OK, so, webpack is both a dependency and a peer dependency. The warning says:
So I have two questions for @weaverryan and @Lyrkan: Ultimately, the goal for a developer, set out in the blog post linked by the OP, is to not depend on a transitive dependency (that is, a dependency of your dependency), as it could change out from under you, or you could want to override it from above, or you could have other dependencies that have different requirements. Leaving things as they are, it seems to me, is to actively discourage what is otherwise a best practice and undermine the benefits of dependency resolution. |
@GPHemsley-RELX As far as I understand if you have Otherwise together with the package hoisting of NPM/Yarn it wouldn't be clear which of these 2 versions would end up toplevel in Please correct me if I'm wrong. |
One of my the oldest issue finally solved by release v4 :D |
It's not a serious problem, just an annoying thing. :)
If I add encore to my package.json as a devdependency i get the warning:
If I don't add it and use anything that depends on webpack I get a warning at yarn install/upgrade:
and same warning with @babel/core
I've found this yarnpkg/yarn#5347 and the link on the closing comment https://yarnpkg.com/blog/2018/04/18/dependencies-done-right/#a-simple-rule
I'm not sure what could be the solution, maybe encore should only peerdepend on the mentioned libs?
The text was updated successfully, but these errors were encountered: