<p dir="auto">Hi,</p>
<p dir="auto">Let's say I have a project with a dependency tree like (all dependencies being declared as "dependencies" in <code class="notranslate">package.json</code>)</p>
<ul dir="auto">
<li>Main application
<ul dir="auto">
<li>angular</li>
<li>Sub-module 1
<ul dir="auto">
<li>angular</li>
</ul>
</li>
<li>Sub-module 2
<ul dir="auto">
<li>angular</li>
</ul>
</li>
</ul>
</li>
</ul>
<p dir="auto">When bundling my app, I will end-up with angular being included 2 times in my webpage. I know I can use <code class="notranslate">webpack.optimize.DedupePlugin()</code> to prevent the file being included multiple times but it will still be called two times at runtime, resulting in a warning "tried to load angular more than once".</p>
<p dir="auto">I feel this is the same for every sub-dependencies shared by my app dependencies, every sub-module will have its own version of angular and even though they use the exact same version, it will be loaded multiple times.</p>
<p dir="auto">Is this tied to the philosophy of not having a flat dependency tree or am I doing something wrong ? One solution I have found is to move all the dependencies of my sub-modules as <code class="notranslate">peerDependencies</code> and add them as dependencies to my "Main application" but I feel like this is a very bad solution.</p>
<p dir="auto">Any insights on this ?</p>
<p dir="auto">Thanks.</p>
<h1 dir="auto">Bug report</h1>
<p dir="auto">Encountered this while trying to upgrade my loader to <code class="notranslate">webpack@5</code>.<br>
In <code class="notranslate">webpack@4</code>, with <code class="notranslate">@types/webpack</code>, I could create a fully typed loader.<br>
In <code class="notranslate">webpack@5</code>, there's aren't any exported types for the <code class="notranslate">Loader</code> or the <code class="notranslate">LoaderContext</code></p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">Auto generate (?) or just include these interfaces:<br>
<a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6a1c6a5567fa177396fa802b2367ec34e1028eea/types/webpack/index.d.ts#L2116">https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6a1c6a5567fa177396fa802b2367ec34e1028eea/types/webpack/index.d.ts#L2116</a></p>
<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.0.0<br>
Node.js version:  14.13.1<br>
Operating System: Fedora 32<br>
Additional tools:</p>