title: compile typescript to js with webpack and keep directory structure
body: <p>I want webpack to compile my typescript node project into js but I want it to maintain the directory structure and not bundle into 1 file.</p>
  
  <p>Is this possible?</p>
  
  <p>My structure is:</p>
  
  <pre><code>src
     |_controllers
       |_home
         |_index.ts
     |_ services
      // etc.
  </code></pre>
  
  <p>And I want it to compile to:</p>
  
  <pre><code>dist
     |_controllers
       |_home
         |_index.ts
     |_ services
      // etc.
  </code></pre>
  
  <p>currently my config is like this:</p>
  
  <pre><code>{
      name: 'api',
      target: 'node',
      externals: getExternals(),
      entry: isDevelopment ? [...entries] : entries,
      devtool: !isDevelopment &amp;&amp; 'cheap-module-source-map',
      output: {
        path: paths.appBuild,
        filename: '[name].js',
        libraryTarget: 'commonjs2'
      },
      plugins: [
        new WriteFilePlugin(),
        new webpack.optimize.LimitChunkCountPlugin({
          maxChunks: 1
        }),
        isProduction &amp;&amp; new webpack.optimize.ModuleConcatenationPlugin()
      ]
    }
  </code></pre>
  
  <p>Is it possible with webpack?</p>
  
  <p>I can't use just <code>tsc</code> because I have a yarn workspaces monorepo and I might have a link reference like this:</p>
  
  <p><code>import {something} from '@my/package';</code></p>
  
  <p><code>@my/package</code> does not exist in npm and only exists in the context of the monorepo, I can use node externals with webpack to include it in the bundle I don't think I can keep the folder structure this way.</p>
  
  <p>Would the new typescript 3.0 project references solve this problem?</p>