title: module `require` base path
body: <p>I'm using Typescript. My sources are in <code>src</code>. When transpiling, Typescript outputs its results to the <code>lib</code> folder. Thus, when requiring my package components, I have to write the following:</p>
  
  <pre><code>import { myModuleMain } from 'mylib/lib'
  import { ComponentA }   from 'mylib/lib/ComponentA'
  import { ComponentB }   from 'mylib/lib/ComponentB'
  </code></pre>
  
  <p>Ok, when it happens just once, it's okay. The problem is when requiring several or many of those components. There are just dozen of <code>/lib</code> path segments everywhere, and I'm trying to get rid of it, to simply do the following:</p>
  
  <pre><code>import { myModuleMain } from 'mylib'
  import { ComponentA }   from 'mylib/ComponentA'
  import { ComponentB }   from 'mylib/ComponentB'
  </code></pre>
  
  <p>I should find a way to define my lib's base path. But as far as I saw, I had to change the <code>require</code>'s searching paths in my lib's code. Is there a way to achieve the same behaviour without changing this search path? Via a <code>package.json</code> property, for example?</p>
  
  <p>I voluntarily omit the option to export all my components in a single <code>main</code> entry point, because files other than my <code>main</code> one are not supposed to be used by the final user: only plugins may use them. In other words, I'd like to have <em>multiple</em> entry points, all in the <code>lib</code> folder. Using the <code>main</code> property in <code>package.json</code> only simplifies the <code>import</code> statement for the 1st module, <em>eg</em> <code>myModuleMain</code></p>