0

I'm using Angular 9 App. installed jsencrypt using npm

npm install jsencrypt

And using this in one of my helper classes as below:

import { JSEncrypt } from 'jsencrypt';
en: any;
export class AuthHelperService {
  constructor(private http: HttpService) {
    this.en = new JSEncrypt();
  }
}

Getting error at following line. How to use this plugin in Angular properly?

import { JSEncrypt } from 'jsencrypt';

Terminal Log:

Error: src/app/core/services/auth-helper.service.ts:2:10 - error TS2614: Module '"../../../../node_modules/jsencrypt/lib"' has no exported member 'JSEncrypt'. Did you mean to use 'import JSEncrypt from "../../../../node_modules/jsencrypt/lib"' instead?

2 import { JSEncrypt } from 'jsencrypt';
Unknown Coder
  • 1,510
  • 2
  • 28
  • 56

1 Answers1

3

the correct way to import JSEncrypt would look like

import JSEncrypt from 'jsencrypt';

the way you are trying to import that object is just wrong

Andrei
  • 10,117
  • 13
  • 21