I'm currently working on a Gatsby project using TypeScript, and I've encountered an issue during the build process (yarn build). The error message I receive is:
Reading from "node:crypto" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. not finished Building HTML renderer - 8.371s error Command failed with exit code 1.
The strange part is that the development server (yarn start) runs without any issues, but the production build fails with the above error. Meaning the SSR fails.
Recently I updated my wagmi package to latest and it's since then the error started occurring. - This is the cause and I've tested it.
Things I've Tried:
- Adding a custom Webpack configuration to shim the crypto module with crypto-browserify.
- Checking for Node-specific modules or browser-specific APIs that might cause SSR issues.
- Clearing cache and public directories.
- Updating all dependencies and plugins to their latest versions.
- Ensuring there are no conflicting versions or incompatible dependencies.
Has anyone encountered this issue before or have any suggestions on how to troubleshoot and resolve it? I appreciate any insights you may provide.
Gatsby Version: 5.11.0 Node Version: 19.1.0 Wagmi Version: 1.3.10