browserify / crypto-browserify

partial implementation of node's `crypto` for the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

smohans opened this issue · comments

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?

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

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.

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.

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".

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

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

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...

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