browserify / crypto-browserify

partial implementation of node's `crypto` for the browser
MIT License
653 stars 199 forks source link

Module not found: Error: Can't resolve 'hash-test-vectors/hmac' with CryptoJS 4.0.0 #198

Closed smohans closed 6 months ago

smohans commented 3 years ago

Getting following error when upgraded crypto-js from 3.3.0 to 4.0.0 and try to build application using webpack(4.41.6),

ERROR in ./node_modules/crypto-browserify/test/create-hmac.js Module not found: Error: Can't resolve 'hash-test-vectors/hmac' in '/node_modules/crypto-browserify/test' @ ./node_modules/crypto-browserify/test/create-hmac.js 4:14-47 @ ./node_modules/crypto-browserify/index.js @ ./node_modules/crypto-js/core.js @ ./node_modules/crypto-js/index.js

ERROR in ./node_modules/crypto-browserify/test/pbkdf2.js Module not found: Error: Can't resolve 'hash-test-vectors/pbkdf2' in '/node_modules/crypto-browserify/test' @ ./node_modules/crypto-browserify/test/pbkdf2.js 4:14-49 @ ./node_modules/crypto-browserify/index.js @ ./node_modules/crypto-js/core.js @ ./node_modules/crypto-js/index.js

Any inputs on how to resolve this dependency?

calvinmetcalf commented 3 years ago

why are you trying to load the test vectors in an app ?

smohans commented 3 years ago

why are you trying to load the test vectors in an app ?

we are not referring these test vectors in app. Those are getting loaded automatically through "crypto-browserify" when tried to build app with webpack.

ljharb commented 3 years ago

That suggests something is wrong with your webpack config. The only files a bundler should ever look at are files you’re directly or indirectly importing/requiring.

smohans commented 3 years ago

That suggests something is wrong with your webpack config. The only files a bundler should ever look at are files you’re directly or indirectly importing/requiring.

Using same webpack config, is working fine for crypto-js: "3.3.0". But, issue is happening when tried to upgrade to "crypto-js": "4.0.0".

ljharb commented 3 years ago

That still suggests to me that your webpack config is broken, but this update has exposed it.

calvinmetcalf commented 3 years ago

I think the issue you are having is with crypto-js which uses this as a dependency.

calvinmetcalf commented 3 years ago

yeah this line is going to import our stuff unclear why it would be trying to import the tests though as a ton of other things use this without running into problems, we arene't even talking about the newest version of webpack either...

rawr51919 commented 3 years ago

This imo sounds more like a crypto-js issue and not an issue with this repo.