Skip to content

chore: switch to crypto-browserify#125

Open
adamrdrew wants to merge 3 commits intosnyk:masterfrom
adamrdrew:move-to-browserify-crypto
Open

chore: switch to crypto-browserify#125
adamrdrew wants to merge 3 commits intosnyk:masterfrom
adamrdrew:move-to-browserify-crypto

Conversation

@adamrdrew
Copy link
Copy Markdown

  • 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