title: 'package.json' is not under 'rootDir'
body: <p>I'm trying to import <code>package.json</code> in my TypeScript application:</p>
  
  <pre><code>import packageJson from '../package.json';
  </code></pre>
  
  <p>My <code>tsconfig.json</code> contains the following:</p>
  
  <pre><code>{
    "compilerOptions": {
      "rootDir": "./src/"
      "outDir": "./dist/",
      "baseUrl": ".",
      "resolveJsonModule": true
    }
  }
  </code></pre>
  
  <p>The problem is that when I compile this, I get</p>
  
  <blockquote>
    <p><code>error TS6059: File '/path/to/package.json' is not under 'rootDir' '/path/to/app/src/'. 'rootDir' is expected to contain all source files.</code></p>
  </blockquote>
  
  <p>I'm not sure I understand the issue, because both <code>./src/</code> and <code>/.dist</code> have the same parent <code>..</code>, so TypeScript could just leave alone the <code>import '../package.json'</code> and <strong>it would work</strong> from either <code>rootDir</code> or <code>outDir</code>.</p>
  
  <p>Anyway, I've tried the following, with unsatisfactory results:</p>
  
  <ul>
  <li>remove <code>rootDir</code> - compilation works, but the <code>dist</code> will contain <code>dist/src</code>, which I don't want</li>
  <li>remove <code>outDir</code> - then <code>src</code> gets polluted with <code>.js</code> files (and <code>.js.map</code> if <code>sourceMap</code> was true)</li>
  <li>add <code>@ts-ignore</code> - compilation stops the the file that imports <code>../package.json</code></li>
  </ul>
  
  <p>What's the workaround for this limitation, to keep generated files in <code>dist</code>, and allow importing from the parent directory of <code>rootDir</code>?</p>