I am using the aws4-axios package for authentication on a React App. I am using this package in order to authenticate an API call with AWS credentials. When I attempt to start the app, I receive an error about the crypto module. I have attempted to remediate this issue by setting crypto to false in my package.json but the error still occurs. If anyone could help, I would deeply appreciate it.
I am inserting the error below.
ERROR in ./node_modules/aws4/aws4.js 4:13-30
Module not found: Error: Can't resolve 'crypto' in '/mnt/c/Users/dalade/code/repos/prism/prism-dashboard/node_modules/aws4'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
webpack compiled with 1 error