bitwiseshiftleft / sjcl

Stanford Javascript Crypto Library
http://bitwiseshiftleft.github.com/sjcl/
Other
7.18k stars 986 forks source link

Can't resolve 'crypto' #362

Open MrBlaise opened 6 years ago

MrBlaise commented 6 years ago

I was redirected here from https://github.com/braintree/braintree-web/issues/366 braintree-web uses sjcl, however since the latest release of Angular it doesn't support shims for crypto and other node native things. This causes a warning during compilation.

WARNING in ./node_modules/braintree-web/data-collector/vendor/sjcl.js
Module not found: Error: Can't resolve 'crypto' in '/REDACTED/node_modules/braintree-web/data-collector/vendor'

This should not create a warning in a browser where there is no crypto library.

batcoder1 commented 6 years ago

hello, i would like to know when will it be fixed? Angular app crash for this warning

core.js:1449 ERROR Error: Uncaught (in promise): ReferenceError: global is not defined ReferenceError: global is not defined at Object../node_modules/braintree-web/lib/promise.js (promise.js:3) at __webpack_require__ (bootstrap:81) at Object../node_modules/braintree-web/american-express/american-express.js (american-express.js:6)

thank you

haseebahmad109 commented 6 years ago

Please post an update on when will it be fixed ?

sbalko commented 6 years ago

Any updates here? It breaks Angular 6 projects.

crookedneighbor commented 6 years ago

We fixed this in braintree-web by providing a browserified version in our npm package, noted in the browser key in the package.json.

Anyone using sjcl directly though will still experience this issue.