title: typescript: resolving typeahead.js with typescript and webpack 2
body: <p>I am getting the following error from webpack.</p>
  
  <blockquote>
    <p>ERROR in ./wwwroot/js/admin/infrastructure/typeaheadComponent.ts
    Module not found: Error: Can't resolve 'typeahead' in ...</p>
  </blockquote>
  
  <p>I have the following installed</p>
  
  <pre><code>npm install typeahead.js
  npm install @types/typeahead
  </code></pre>
  
  <p>My typescript is as follows, using <code>node</code> module resolution.</p>
  
  <pre><code>import { module } from "angular";
  import "typeahead";
  // necessary to import typeahead into JQuery, as otherwise
  // typeahead below is not defined.
  
  class TypeAheadController {
      foo(e) {
         $(e).typeahead(...)
      }
  }
  </code></pre>
  
  <p>this generates javascript as follows:</p>
  
  <pre><code>"use strict";
  var angular_1 = require("angular");
  require("typeahead");
  var TypeAheadController = (function () { ...
  </code></pre>
  
  <p>My webpack.config.js is as follows:</p>
  
  <pre><code>module.exports = {
      context: __dirname,
      entry: [
          "./app.ts",
          "./tab.ts",
          "./client/clientService.ts",
          "./client/clientSearchComponent.ts",
          "./infrastructure/messageComponent.ts",
          "./infrastructure/typeaheadComponent.ts",
          "./url.ts"],
      output: {
          filename: "./wwwroot/js/admin/admin.js"
      },
      devtool: "source-map",
      module: {
          rules: [
              { test: /\.ts$/, use: 'ts-loader' }
          ]
      }
  };
  </code></pre>
  
  <p>imported into a gulp task.</p>
  
  <p>How do I specify that <code>typeahead</code> is located in <code>node_modules/typeahead.js/dist/typeahead.bundle.js</code></p>