I was using mcrypt in a typescript+webpack project for AWS Lambda function.My unit tests were working fine locally. However after building via webpack and deploying it to AWS it was giving me this error:
module initialization error: TypeError.
I have tried lots to fix it but I did not have any luck. Once I removed importing the locally in my module everything was working fine in AWS.
I could not realise what is the issue so at the end I had to use another library.