Hi, @thegr8khallie. I don’t know what the source of the error is but I’m 100% certain that Netlify isn’t causing it.
To prove this, I tested a fresh clone of the repo (because it is a public reop). The commands I ran below to test with some details redacted as you haven’t shared the repo URL. I can see the repo because I’m a member of the technical support team at Netlify. Here is how I tested:
git clone <REPO URL HERE>
cd <REPO NAME HERE>
nvm use 16.17.1 ## the same node version used in your build at NETLIFY
npm install
npm run build
As you can see below, I get the same error:
$ npm run build
> wallx@0.1.0 build
> react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve 'crypto' in '/home/username/tmp/<REPO NAME>/node_modules/algosdk/dist/browser'
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 }
This proves the error is not being caused by Netlify (because I didn’t use Netlify at all for the test above).
So, your build is failing on my local machine and not just at Netlify. This is an issue with your repo and you’ll need to resolve this error before it will work outside your local system, meaning Netlify or anywhere else.
If there are other questions about this, please let us know.
Yes, I know that this is not a problem from Netlify, I just posted this to seek help from people that might have had similar problems in the past. I have also added a fallback in my webpack.config.js file and it still returns the same error, so it must be something else.
As this is a webpack specific issue (as you acknowledge yourself) you might find more direct meaningful assistance looking at webpack discussions on GitHub