Given the following directory structure:
You can see both my-project
require React. I have the same problem as described on this question
, but the suggestion is to remove react from the package.json dependencies. I do that and it works fine, as long as no node_modules are installed in module-x
, because Webpack will use React from my-project
. But if I'm in the process of developing module-x
and the node_modules are installed, Webpack uses React from both my-project
Is there a way I could have Webpack make sure only one instance of React is used, even though it's required on two separate levels?
I know I could keep module-x
in a separate directory when developing, but it seems like I'd have to publish it and then install it in my-project
to test it, and that's not very efficient. I thought about
, but had no luck with it since it still has node_modules installed in module-x
sounds a lot like the same challenge I'm having, but it doesn't seem like
or Webpack's dedupe option would work. I'm probably not understanding some important detail.