speedskater / babel-plugin-rewire

A babel plugin adding the ability to rewire module dependencies. This enables to mock modules for testing purposes.
842 stars 90 forks source link

Dependancy warnings for babel-core, babel-template & babel-types #182

Open djforth opened 7 years ago

djforth commented 7 years ago

Getting the following when I install with "babel-core": "^6.23.0",

warning "babel-plugin-rewire@1.0.0" has unmet peer dependency "babel-core@^6.0.0".
warning "babel-plugin-rewire@1.0.0" has unmet peer dependency "babel-template@^6.2.0".
warning "babel-plugin-rewire@1.0.0" has unmet peer dependency "babel-types@^6.2.0".

Would there be any issue with upping the dependancies?

jharris4 commented 7 years ago

Just noticed the same warning, except I only get 2 warnings since I have babel-core installed as a dependency:

warning "babel-plugin-rewire@1.0.0" has unmet peer dependency "babel-template@^6.2.0".
warning "babel-plugin-rewire@1.0.0" has unmet peer dependency "babel-types@^6.2.0".

I find these warnings to be strange, since both babel-template and babel-types are listed as dependencies of babel-core.

So I don't think it's a version number issue, but maybe a quirk with the way peerDependencies work?

I think maybe the question is, can we just make babel-core the peerDependency, and remove the others?

jharris4 commented 7 years ago

Oh, and I'm only seeing this warning with yarn, not with npm

jharris4 commented 7 years ago

I think this may just be another example of this yarn issue:

https://github.com/yarnpkg/yarn/issues/2132

djforth commented 7 years ago

Yeah looks to be a yarn only issue, you might be right that it is just a yarn error.

amakhrov commented 6 years ago

It's still happening even with the latest yarn. Generally, the issue happens because projects normally do NOT add babel-types/babel-template as dependencies - instead they just depend on babel-core. And it's actually a coincidence that npm and yarn generate a flat node_modules structure where possible, resulting in the dependencies of babel-core residing at top-level directory and being available for all other modules.

My take on that is that babel-template and babel-types should be moved from peerDependencies to dependencies.

amakhrov commented 6 years ago

@speedskater any further thoughts on that?