I am trying to use fingerprint2.js in Angular project.
First, I installed the library via:
npm install fingerprintjs2
Added:
./node_modules/fingerprintjs2/fingerprint2.js
in angular.json
file in scripts section.
Imported the library in app.module.ts or myservice.ts as:
import * as Fingerprint2 from 'fingerprintjs2'
After importing, I am getting Cannot find module 'fingerprintjs2'
error.
Is there any solution? What is it that I am doing wrong?
I was having the same problem with fingerprintjs2 after I upgraded to 2.0.4. Going back to version 2.0.3 fixed it. They changed something in the latest release around module.exports: https://github.com/Valve/fingerprintjs2/commit/1e07962c04bb473af6c024e562b60f11581d6a99