Skip to content

chore: switch to crypto-browserify #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adamrdrew
Copy link

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Switch from the node crypto library to crypto-browserify.

Where should the reviewer start?

Tests pass with this change and your tests cover this code path so we should be good.

How should this be manually tested?

Any background context you want to provide?

I need to work with the backstage snyk plugin which depends on this library, and when using webpack 5 this library fails because webpack 5 doesn't provide a polyfill for crypto

Error: Failed to compile '../../node_modules/@snyk/dep-graph/dist/legacy/index.js':
  Module not found: Error: Can't resolve 'crypto' in '/home/adamdrew/Development/snyk-plugin-dev/node_modules/@snyk/dep-graph/dist/legacy'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
	- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "crypto": false }

What are the relevant tickets?

Screenshots

Additional questions

@adamrdrew adamrdrew requested a review from a team as a code owner May 2, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant