title: Reference Js file from TypeScript file with webpack
body: <p>I'm a bit lost... I'm trying to use PDFJS to render a PDF with JavaScript and now I need to use a plugin to make text selectable. According to <a href="https://www.sitepoint.com/custom-pdf-rendering/" rel="nofollow noreferrer">this article</a>, I have to use <a href="https://raw.githubusercontent.com/mozilla/pdf.js/v1.4.20/web/text_layer_builder.js" rel="nofollow noreferrer">this file</a>. As it seems not to be available on npm, I added it to my source code and bundle it with webpack in a vendor.bundle.js file:</p>
  
  <pre><code>entry: {
      "app": "./src/index.ts",
      "vendor": ["pdfjs-dist/build/pdf.worker.entry", "./vendors/uiMask.js", "./vendors/pdfjs/text_layer_builder.js"]
  }
  </code></pre>
  
  <p>Now, I'd like to use it in my TypeScript file, so I do:</p>
  
  <pre><code>var TextLayerBuilder = require('../../../vendors/pdfjs/text_layer_builder');
  </code></pre>
  
  <p>Webpack does not complain but when I do:</p>
  
  <pre><code>let textLayer: any = new TextLayerBuilder({
      textLayerDiv: textLayerDiv,
      pageIndex: page.pageIndex,
      viewport: viewport
  });
  </code></pre>
  
  <p>Chrome says that <code>TextLayerBuilder</code> is not a constructor. When I do a <code>console.log</code> of this object, it appears to be an empty object.</p>
  
  <p>How can I use this file in my TypeScript one?</p>