title: Importing Javascript library (jsencrypt) into Angular 2 app
body: <p>I have looked through all the tutorials revolving around this issue, and havn't been able to find a solution. Some background first. I have a Angular 2 app and I need to use this JS library for encryption: <a href="https://github.com/travist/jsencrypt" rel="nofollow noreferrer">https://github.com/travist/jsencrypt</a></p>
  
  <p>First, I installed the jsencrypt node module with the line: npm install --save jsencrypt. This worked, and the jsencrypt module could be found in my node_modules folder. </p>
  
  <p>Some tutorials told me to create a src/typings.d.ts file then add in the following line: declare module 'jsencrypt';</p>
  
  <p>Then, in my comonents.ts file I import it with this line:
  import * as JSEncrypt from 'jsencrypt';</p>
  
  <p>I also tried adding &lt; script src="/node_modules/jsencrypt/bin/jsencrypt.js">&lt; /script></p>
  
  <p>into my .html file. </p>
  
  <p>In the init of my .component file, I try declaring a simple JSEncrypt object:
  var decrypt = new JSEncrypt();</p>
  
  <p>And the console displays this error: 
  TypeError: Object is not a constructor (evaluating 'new <strong>WEBPACK_IMPORTED_MODULE_4_jsencrypt</strong>()')</p>
  
  <p>So I'm assuming it does not recognize the jsencrypt module. </p>
  
  <p>I have only been working with Angular for a couple of days, so I'm very new to all the terminology and basic understanding of the structural components of an Angular application. Any help is greatly appreciated. </p>
  
  <p>Used this tutorial as a starting point:
  <a href="https://hackernoon.com/how-to-use-javascript-libraries-in-angular-2-apps-ff274ba601af" rel="nofollow noreferrer">https://hackernoon.com/how-to-use-javascript-libraries-in-angular-2-apps-ff274ba601af</a></p>