braintree-web: Can't resolve 'crypto' (Angular 6)

General information

  • SDK version: 3.33.0
  • Environment: Sandbox and Production (Angular)
  • Browser and OS: All

Issue description

When trying to build an angular 6 application that uses braintree-web it will print out the following warning.

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'

Angular 6 removed the shims to support non browser (node) libraries. What can be done in this case?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

v3.36.0 on npm includes a browser property in the package.json that points to a browserified version of the file. Webpack should use this path instead and this should fix the issues with Angular 6. Please update and comment here if you’re still having issues.

I think I’ve found a solution for this. Will keep y’all updated.