Force dependency to use specific sub dependency version
<p>I am building my website code with webpack and npm modules and sutmbled upon the following problem:</p>

<p>My code uses jQuery 3.1.1 and adds some plugins to it.
I am also using a dependency that has a sub-depencency on jQuery &lt;= 2.2.4.
The problem is, that the objects of the sub-dependency obviously don't know about my jQuery plugins, since the module uses a different jquery version.</p>

<p>How can I force all dependencies (top level and nested) to use one version of jQuery? So that <code>require("jquery")</code> always resolves to jQuery 3.1.1.</p>

<p>I've tried using npm shrinkwrap to override the dependency version but that does not seem to work. This is my modified shrinkwrap file:</p>

<pre><code>{
  "name": "example",
  "version": "0.1.0",
  "dependencies": {
    "can": {
      "version": "2.3.27",
      "from": "can@&gt;=2.3.23 &lt;3.0.0",
      "resolved": "https://registry.npmjs.org/can/-/can-2.3.27.tgz",
      "dependencies": {
        "jquery": {
          "version": "3.1.1",
          "from": "^3.1.1"
        }
      }
    }
  }
}
</code></pre>

<p>But the dependency of the module is still jQuery 2.2.4 and <code>npm install</code> prints <code>npm ERR! invalid: jquery@3.1.1 /path/.../can/node_modules/jquery</code></p>

<p>Solutions to solve the issue with webpack instead of npm are also accepted.</p>