Reputation: 759
I tried to use md5 hash for hashing user password in Angular 2, but for some reason when I run my application Md5 module is not recognized.
I have also imported it in typescript file like this: import { Md5 } from 'ts-md5/dist/md5';
For me it's weird that Md5 is recognized in Visual Studio, but in Google Chrome I get error as you can see on picture. So my question is where is the mistake and how to fix it?
Upvotes: 1
Views: 2591
Reputation: 310
If you are using systemJS (systemjs.config) then in that file you will need to include:
map: {
'ts-md5': 'node_modules/ts-md5',
}
packages: {
'ts-md5': {main: '/md5.js'},
}
Look for both 'map' and 'packages' inside of systemjs.config and then include 'ts-md5' in them. This will tell the app where to look for those files.
Also make sure that you have installed it first using npm install ts-md5 --save
Upvotes: 1