title: Exclude a local TypeScript library from application bundle
body: <p>How can I exclude a local TypeScript library from the bundle that is created for my application? In my use case, I want to provide the bundle for my TypeScript library  and the bundle for my application as separate JavaScript files.</p>
  
  <h1>My Library</h1>
  
  <p><strong>index.ts</strong></p>
  
  <pre><code>export class Greeter {
      public greet(): void {
          console.log("Hello World"); 
      }
  }
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
      "private": true,
      "devDependencies": {
          "typescript": "3.1.1",
          "ts-loader": "5.2.1",
          "webpack": "4.20.2",
          "webpack-cli": "3.1.2"
      },
      "scripts": {
          "start": "webpack"
      }
  }
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
      "compilerOptions": {
          "module": "es6",
          "target": "es5"
      }
  }
  </code></pre>
  
  <p><strong>webpack.config.js</strong></p>
  
  <pre><code>module.exports = {
      entry: './src/index.ts',
      resolve: { extensions: [".js", ".ts"] },
      output: { filename: 'bundle.js', library: '@mylib', libraryTarget: 'umd' },
      module: { rules: [ { test: /\.ts$/, use: 'ts-loader' } ] }
  };
  </code></pre>
  
  <h1>My Application</h1>
  
  <p><strong>index.ts</strong></p>
  
  <pre><code>import {Greeter} from "@mylib/index";
  
  new Greeter().greet();
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
      "private": true,
      "devDependencies": {
          "typescript": "3.1.1",
          "tsconfig-paths-webpack-plugin": "3.2.0",
          "ts-loader": "5.2.1",
          "webpack": "4.20.2",
          "webpack-cli": "3.1.2"
      },
      "scripts": {
          "start": "webpack"
      }
  }
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
      "compilerOptions": {
          "baseUrl": ".",
          "paths": { "@mylib/*": ["../mylib/src/*"] },
          "module": "es6",
          "target": "es5"
      }
  }
  </code></pre>
  
  <p><strong>webpack.config.js</strong></p>
  
  <pre><code>const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
  
  module.exports = {
      entry: './src/index.ts',
      resolve: { extensions: [".ts", "js"], plugins: [new TsconfigPathsPlugin({})] },
      output: { filename: 'bundle.js' },
      module: { rules: [ { test: /\.ts$/, use: 'ts-loader' } ] }
  };
  </code></pre>
  
  <p>In my example, the library code is included in the bundle of the application. I would like that the library will be <strong>not included</strong> so that I can provide it as a separate bundle.</p>