browserify / randombytes

random bytes from browserify stand alone
MIT License
100 stars 48 forks source link

Polyfill ignored in React App for crypto-browserify #32

Closed Spencer-Hawkins closed 2 years ago

Spencer-Hawkins commented 2 years ago

I'm building a React App where I installed the aes256 package. I'm working with webpack over 5.0, so I know I need to polyfill node core modules I want to use. The only one I need is 'crypto' to be able to run aes256.

I set up my webpack.config.js with the required fallback

module.exports = { resolve: { fallback: { crypto: require.resolve("crypto-browserify"), }, }, };

but my error message states " If you want to include a polyfill, you need to:

ERROR in ./node_modules/aes256/index.js 2:13-30 Module not found: Error: Can't resolve 'crypto' in '/mnt/c/Users/.../demo-project-hardhat-react/node_modules/aes256' "

I have already ran 'npm i crypto-browserify' and it is up to date. Does anyone know why my project would be unable to recognize this polyfill?

Spencer-Hawkins commented 2 years ago

Nevermind, was an error with multiple webpack configurations.