-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Start warning when multiple versions of a library appear in one build #385
Comments
I think it's a common problem for NPM on client-side and, while Webpack plugin could do this, I think it would benefit a wider community if we could mark packages we want to never be duped, in some way in @domenic what do you think? You advocated NPM on client-side, this is a very typical issue. |
I think it should warn if there are two copies that are the same major version. E.g. if you have 1.5.2 and 2.1.0 it should not warn, but if you have 2.0.1 and 2.1.0 it should warn. Also it should never warn on multiple 0.x.y versions. (So basically it should warn if you have two copies that are semver-compatible.) The warning would then happen in only a few cases:
|
That's a tricky issue, we discussed it a lot (#105 #47 #340). Imho @domenic has this issue been discussed at npm? @alanhogan maybe warnings are a bit too strong. It would be nice if webpack provided optimizations hints on demand. |
Thanks for your response. I’m glad to see this is under a lot of debate. I don’t much care whether they are packaged as hints or warnings. But I will say that more than just an optimization, this can cause serious (and subtle) bugs; a warning may yet be appropriate. |
This would be nice - I've spent days debugging why my router plugins were not working, and after I noticed that the backbone.js I was debugging was not the same file as the one I had installed I realized what was wrong. |
I think this is a very important feature when using NPM and webpack, not only because of possible bugs but also to avoid bloating the build with different versions of the same package. Update: |
Webpack 2 dropped the DedepePlugin: https://webpack.js.org/guides/migrating/#dedupeplugin-has-been-removed. Using the plugin provided by @darrenscerri, I can see that my build does have duplicates. In development:
In production:
What is the recommended approach to handling duplicates without DedupePlugin? |
@loopmode. You would need to start by checking which modules are requiring those duplicates. Usually the solution is to update your dependencies. |
What do you do if they include third party dependencies from dependencies which were already updated to the latest version? <lodash.debounce> |
I'm wondering the same thing. After updating React (using yarn):
|
I think yarn now has an option that allows you to override package versions of your depencencies’ depencencies via a new option in package.json. They call this “selective version resolution.” I haven’t tried it yet. |
Does exist some kind of approach to solve the problem that dg-grow-virgiliu-ratoi exposed? |
how about the documentation section on their website, is that good? |
I'll try it, thanks. :) Anyway, is in the roadmap some kind of stable solution for this problem? npm allows multiple versions for any dependency, It's not difficult to reproduce this problem. |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
9 years later let's work on this 🤣😭😅🙃 |
clayallsopp/react.backbone#26 and similar issues would be more readily identified and prevented if Webpack could say things like “hey, just FYI, you have <React/Underscore/jQuery> being included twice in this build.” Will be a common problem as the industry moves away from a manual folder of
lib/some-library.min.js
towardspackage.json
and various dependency management tools.The text was updated successfully, but these errors were encountered: