title: Unable to use import instead of require, or unable to build dependensides with ts-node & tsdx
body: <p>I have the following problem and know exactly why it has been triggered, but I haven't found any solution yet, so probably the community may help me with that.</p>
  <p>I am using <code>tsdx</code> for initiating ts repos, and also <code>ts-node</code> for quick debug (instead of building code each time).</p>
  <h3>Recursive Dilemma:</h3>
  <p>So, each time when I want to add the module to my package via <code>yarn add modulename</code> and if in my <code>tsconfig.json</code> file in <code>compilerOptions</code> option: <code>&quot;module&quot;: &quot;commonjs&quot;</code> has the following value, <code>tsdx build</code> unable to build code, and return me the following error:</p>
  <blockquote>
  <p><em>Error: Incompatible tsconfig option. Module resolves to 'CommonJS'. This is incompatible with rollup, please use 'module: &quot;ES2015&quot;' or 'module: &quot;ESNext&quot;'</em></p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/5t1Iy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5t1Iy.png" alt="module: &quot;ES2015&quot;" /></a></p>
  <p><strong>BUT!</strong></p>
  <p>if I will update <code>compilerOptions</code> to <code>module: &quot;ESNext&quot;</code> from <code>commonjs</code>, <code>ts-node</code> will give me an error, because it's still unable to use <code>import {Method} from Module</code> instead of <code>const x = require(CommonJS)</code> (which is quite old bug, according to <a href="https://github.com/TypeStrong/ts-node/issues/935#issuecomment-579718641" rel="nofollow noreferrer">this issue</a> and <a href="https://stackoverflow.com/questions/61568271/import-doesnt-work-with-module-esnext-in-tsconfig-json">this question</a>)
  <a href="https://i.stack.imgur.com/MkNC6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MkNC6.png" alt="enter image description here" /></a></p>
  <ul>
  <li>Typescript -v 4.1.5 (latest)</li>
  <li>ts-node: &quot;^9.1.1&quot;</li>
  <li>node -v: 15+</li>
  </ul>
  <pre><code>  &quot;compilerOptions&quot;: {
      &quot;module&quot;: &quot;commonjs&quot;, || &quot;ESNext&quot;
      &quot;lib&quot;: [&quot;dom&quot;, &quot;esnext&quot;],
      ...//other options
  </code></pre>
  <p>According to that, I am using WebStorm and <a href="https://github.com/TypeStrong/ts-node#intellij-and-webstorm" rel="nofollow noreferrer"><code>README.md</code></a> from ts-node repo, I understand, that I could update <code>Environment Variables</code> with custom tsconfig. <em>So in that case I need two tsconfig files in repo, for ts-node and for production</em>. So the question is: maybe there is another TS_NODE_FLAG, especially for <code>module</code> compiler options? So I could run ts-node with the flag, that would overwrite this minor parameter?</p>