title: How do I include a javascript library with angular 2?
body: <p>How do I use a javascript library with angular 2? I always get an error saying it's not a module.</p>
  
  <p>If I add a script tag to my index.html file pointing to the javascript file, then add it under paths under System.config, then import it, I get an error stating that it's not a module.</p>
  
  <p>I've already tried <a href="https://www.thepolyglotdeveloper.com/2016/01/include-external-javascript-libraries-in-an-angular-2-typescript-project/" rel="nofollow">this</a> and I've also tried <a href="https://medium.com/@s_eschweiler/using-external-libraries-with-angular-2-87e06db8e5d1#.doijw41gd" rel="nofollow">this</a>. Neither of them work despite the fact they seem to like to point out that it's easy, and that you can use any of hundreds of libraries.</p>
  
  <p>Here is a javascript library: <a href="https://github.com/SheetJS/js-xlsx" rel="nofollow">sheetjs</a></p>
  
  <p>How do I make this work in angular 2?</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;script src="../node_modules/xlsx/xlsx.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>system-config.ts</p>
  
  <pre><code>System.config({
  ...
       path: {
        xlsx: '../node_modules/xlsx/xlsx.js'
      }
  });
  </code></pre>
  
  <p>something.ts</p>
  
  <pre><code>import * as xlsx from 'xlsx';
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>Error: Typescript found the following errors:
    C:/___/tmp/broccoli_type_script_compiler-input_base_path-o4TZ9PSC.tmp/0/src/app/something/something.component.ts (9, 23): Cannot find module 'xlsx'.
  </code></pre>