How to import crypto-js in Ionic 4

Viewed 6335

I used following npm command to install

npm install crypto-js

After installing i imported

import CryptoJS from 'crypto-js';

But i am not getting any when i type Crypto. i dont get any IntelliSense. I have read on some of the posts which says that i need to add

npm install --save @types/crypto-js

Tried that as well but then i start getting the error on import statement

I will appreciate if someone can guide me what are the steps i need to follow to make this work.

1 Answers

You need to import like this:

import * as CryptoJS from 'crypto-js';
Related