title: Webpack dynamic imports bundles the whole module instead of making the named import a network call
body: <p>Webpack bundles all the exports of my_components into a bundle making the build 62k when I use dynamic imports:</p>
  <pre><code>import { input_with_label } from &quot;my_components&quot;;
  
      const init = async () =&gt; {
          const { dom_diffing } = await import(
              /* webpackChunkName: &quot;my-chunk-name&quot; */
              /* webpackMode: &quot;lazy&quot; */ &quot;my_components&quot;
          );
        }
        
  init();
  </code></pre>
  <p>When I just import the dom_diffing named export like this:</p>
  <pre><code>import { input_with_label, dom_diffing } from &quot;my_components&quot;;
  </code></pre>
  <p>The bundle is compiled correctly into a 29k bundle.</p>
  <p>I would think Webpack would make the build with the dynamic import smaller, but instead, it just takes all the exports from my_components and bundles them into my file making it larger.</p>
  <p>How can I get Webpack to not bundle all of my_components into a compiled file, and lazy load the dynamic import through a network call?</p>
  <p>my_components is an npm package, and I am using typescript with ts-loader. &quot;webpack&quot;: &quot;^5.73.0&quot;</p>