title: How to produce a single *.d.ts or multiple with relative path
body: <h3>Problem</h3>
  
  <p>[It only infects typescript library creators]</p>
  
  <p>if the code base contains absolute paths (by configuring <code>tsconfig.json</code> and webpack), then the typescript compiler will generate all the d.ts files with the same absolute paths that are useless because my lib consumers can't do a thing with them. </p>
  
  <hr>
  
  <h3>Workarounds</h3>
  
  <p>Every library that <strong>I saw</strong> are doing one of the following:</p>
  
  <ol>
  <li>creating their own single-file.d.ts file manually</li>
  <li>using relative path in their code base so the output d.ts files also contain relative paths.</li>
  </ol>
  
  <p><strong><em>Clearly, both alternatives suck.</em></strong></p>
  
  <hr>
  
  <h3>Other solution that I thought about</h3>
  
  <ol>
  <li>creating a single d.ts file (there will be no imports). </li>
  </ol>
  
  <p>I couldn't find a working library for that.</p>
  
  <ol start="2">
  <li>not sure if it's possible: before running ts-loader, we need to run a magic babel-plugin to transform every absolute path to a relative by looking in the webpack-resolve-module section in webpack.config file.</li>
  </ol>
  
  <hr>
  
  <h3>My current status</h3>
  
  <p>I created a library that generates broken d.ts files with absolute paths:</p>
  
  <p><a href="https://github.com/stavalfi/lerna-yarn-workspaces-example/tree/master/packages/x-core" rel="nofollow noreferrer">https://github.com/stavalfi/lerna-yarn-workspaces-example/tree/master/packages/x-core</a></p>
  
  <p>index.ts:</p>
  
  <pre><code>import { z, x } from 'shalom'     // problem
  export default function awesomeFn(y: number): x {
    return z(1)
  }
  
  export { z, x } from './shalom' . // not a problem
  </code></pre>
  
  <p>generated index.d.ts:</p>
  
  <pre><code>import { x } from './shalom';     /// GOOD - becuase I used relative
  export default function awesomeFn(y: number): x;
  export { z, x } from 'shalom';    /// BAD - because I used absolute
  //# sourceMappingURL=index.d.ts.map .   
  </code></pre>
  
  <hr>
  
  <h1>Question</h1>
  
  <p>Is there any sort of solution/workaround that is not stop using an absolute path or creating my own single.d.ts file manually?</p>