-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Prerequisites
- I have searched the existing issues
- I understand that providing a SSCCE example is tremendously useful to the maintainers.
- I have read the documentation
- Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
core
Version
5.x
Current Behavior
I am trying to compile nbdime for Debian using webpack 5.97.1, but I get the following error when running webpack --mode=production
on nbdime-webapp:
ERROR in node:crypto
Module build failed: UnhandledSchemeError: 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.
(The full build and error message can currently be found at https://salsa.debian.org/jdg/nbdime/-/jobs/8044146)
My Debian colleague Jérémy Lal (@kapouer) has identified the source of the problem (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1111481). Paraphrasing what he has written there:
@rjsf/core
builds esm/cjs bundles, and depends on nanoid.
nanoid correctly exports a browser bundle, but @rjsf/core
doesn't use that file, it uses the cjs file, which requires node:crypto
, which is not supported in the browser. The nanoid/index.browser.js
file instead uses the native window.crypto.getRandomValues
, and they are not interchangeable.
This produces bugs when a project makes a bundle using @rjsf/core
, as (recent versions of) webpack give an error because the node:
prefix is not supported. The problem isn't in webpack, it's really a problem with @rjsf/core
not correctly exporting a browser bundle.
Expected Behavior
The webpacking of modules depending on @rjsf/core
should complete without error.
Steps To Reproduce
Try compiling nbdime with a current version of webpack.
Environment
- OS: Debian GNU/Linux 13.0
- Node: 20.19.2
- npm: 9.2.0