title: How to import external library in angular2?
body: <p>I am following this (<a href="https://www.thepolyglotdeveloper.com/2016/01/include-external-javascript-libraries-in-an-angular-2-typescript-project/" rel="nofollow noreferrer">https://www.thepolyglotdeveloper.com/2016/01/include-external-javascript-libraries-in-an-angular-2-typescript-project/</a>)  to import external library. However I can’t mimic it the same way. I got the following error, </p>
  
  <p>GET <a href="http://127.0.0.1:8080/src/rxjs/Subject" rel="nofollow noreferrer">http://127.0.0.1:8080/src/rxjs/Subject</a> 404 (Not Found). </p>
  
  <p>Inside src, folder, I have two folders, app and js and two files, index.html and tsconfig.json. </p>
  
  <p>App.ts</p>
  
  <pre><code>declare var jsSHA: any;
  
  @Component({
      selector: "my-app",
      templateUrl: "app/app.html",
      directives: []
  })
  
  class App {
  
      shaObj: any;
      hash: String;
  
      constructor() {
          this.shaObj = new jsSHA("SHA-512", "TEXT");
          this.shaObj.update("This is a test");
          this.hash = this.shaObj.getHash("HEX");
      }
  
  }
  
  bootstrap(App, []);
  </code></pre>
  
  <p>app.html</p>
  
  <pre><code>&lt;h1&gt;SHA-512 Hash&lt;/h1&gt;
  
  &lt;p&gt;String: This is a test&lt;/p&gt;
  &lt;p&gt;HEX: {{hash}}&lt;/p&gt;
  </code></pre>
  
  <p>Index.html</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Angular 2 QuickStart&lt;/title&gt;
          &lt;script src="../node_modules/angular2/bundles/angular2-polyfills.js"&gt;&lt;/script&gt;
          &lt;script src="../node_modules/systemjs/dist/system.src.js"&gt;&lt;/script&gt;
          &lt;script src="../node_modules/rxjs/bundles/Rx.js"&gt;&lt;/script&gt;
          &lt;script src="../node_modules/angular2/bundles/angular2.dev.js"&gt;&lt;/script&gt;
          &lt;script src="js/sha.js"&gt;&lt;/script&gt;
          &lt;script&gt;
              System.config({
                  packages: {'app': {defaultExtension: 'js'}}
              });
              System.import('app/app');
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;my-app&gt;Loading...&lt;/my-app&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>system.config.js</p>
  
  <pre><code>(function (global) {
      System.config({
          paths: {
              // paths serve as alias
              'npm:': 'node_modules/'
          },
          // map tells the System loader where to look for things
          map: {
              // our app is within the app folder
              app: 'app',
              // angular bundles
              '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
              '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
              '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
              '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
              '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
              '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
              '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
              '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
              // other libraries
              'rxjs': 'npm:rxjs',
              'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
              'underscore': 'node_modules/underscore/underscore.js'
          },
          // packages tells the System loader how to load when no filename and/or no extension
          packages: {
              app: {
                  main: './app.js',
                  defaultExtension: 'js'
              },
              rxjs: {
                  defaultExtension: 'js'
              }
          }
      });
  })(this);
  </code></pre>
  
  <p>If someone have any clue about this problem, please give me advice.</p>