Description
Hello, I have a Gatsby project that when I import the library @datocms/cma-client-browser, it gives the following error during the build phase (gatsby build). The original project is complex, but I was able to reproduce the error in the linked repo.
The error occurs both locally and on Netlify. By removing import { buildClient } from “@datocms/cma-client-browser”; from the index.js file, the build completes successfully. Would you be able to help me understand the issue? Unfortunately, the error doesn’t provide much information. It might be related to Gatsby’s webpack settings, but all the workarounds I’ve tried haven’t solved the issue.
Reproduction Link
https://github.com/MultiDigital/datocms-ssr
Steps to Reproduce
- yarn
- gastby build
Expected Result
Build completed succesfully
Actual Result
ERROR #98123 WEBPACK
Generating SSR bundle failed
Reading from “node:events” 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.
File: node:events
ERROR #98123 WEBPACK
Generating SSR bundle failed
Reading from “node:stream” 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.
File: node:stream
ERROR #98123 WEBPACK
Generating SSR bundle failed
Reading from “node:util” 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.
File: node:util
Environment
System:
OS: macOS 13.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.5.0 - ~/.nvm/versions/node/v19.5.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v19.5.0/bin/npm
Browsers:
Chrome: 119.0.6045.33
Firefox: 117.0
Safari: 16.2