title: Share a common package between server and client
body: <p>I want to have the following project setup:
  Three top-level folders client, common and server. All of them is a separate package with its own package.json and node_modules folder.</p>
  
  <p>For the example below I use this structure:</p>
  
  <pre><code>- common
    - node_modules
    - package.json
    - entities.ts
  
  - server
    - node_modules
    - package.json
    - app.ts
    - tsconfig.json
  </code></pre>
  
  <p>And I try to run tsc in the server folder</p>
  
  <p>Files that should be used by both client and server will be in the common folder and I would like to use ES6 module syntax for importing them from both server and client like <code>import {MyModel} from 'common/entities';</code></p>
  
  <p>The problem is that I can't figure out how to setup typescript to understand this setup.</p>
  
  <p>I have used <code>npm link</code> to make common appear as a normal node_module in the server but the above import generates the error <code>Cannot find module 'common/entities'</code>. I tried adding <code>"moduleResolution": "node"</code> to <code>compilerOptions</code> without result.</p>
  
  <p>Is there possible to get typescript to understand this setup or is there a setup that is preffered to this?</p>