title: esbuild not bundling internal file imports when the "bundle" is turned off
body: <p>Consider this very contrived npm package:</p>
  <pre><code>import clone from &quot;lodash.clonedeep&quot;;
  import calculate from &quot;./utils/calculate&quot;; // &quot;.ts&quot; omitted
  
  function x(obj:any):number {
    return calculate(clone(obj).a, clone(obj).b);
  }
  export { x }
  </code></pre>
  <p>Imagine we want an <code>esm</code> build of this.</p>
  <ul>
  <li>If we set <code>esbuild</code> to &quot;bundle&quot;, both external <code>clone</code> and internal <code>calculate</code> imports will end up in the generated file. (That's cool, I want that for <code>iife</code> build).</li>
  <li>If we set <code>esbuild</code> not to &quot;bundle&quot;, neither external <code>clone</code> nor internal <code>calculate</code> will end up in the generated file. (That's not cool, I want <code>calculate</code> bundled still).</li>
  </ul>
  <p>In Rollup, &quot;bundling&quot; in this sense pertains only for external imports; internal-ones are all placed into one file by default.</p>
  <p>Do you know how to set <code>esbuild</code> to include only internal file imports? To get:</p>
  <pre class="lang-js prettyprint-override"><code>import clone from &quot;lodash.clonedeep&quot;;
  
  function calculate(a, b) {
    return a * b;
  }
  function x(obj){
    return calculate(clone(obj).a, clone(obj).b);
  }
  export { x }
  </code></pre>
  <p>I'm simply trying to make some <code>esm</code>/<code>cjs</code> npm package builds.</p>
  <p>Other questions in SO are different: <a href="https://stackoverflow.com/questions/63086520/esbuild-not-bundling-files">this one</a> is concatenating multiple files into one. Here we're just trying to replicate Rollup's behaviour, to include local imports but not external, like in a normal npm package. Thank you.</p>