[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with nbdime packaging





Le mer. 30 juil. 2025 à 23:14, Julian Gilbey <jdg@debian.org> a écrit :
Hi!

I'm trying to package nbdime (a Python/NodeJS combo), and I've hit a
snag I can't work out how to resolve.  My WIP is on salsa in a
personal fork: https://salsa.debian.org/jdg/nbdime.git

One of the packages in the repository is webapp, and it is built using
webpack.  But webpack throws an error because @rjsf/core imports from
node:crypto (/usr/share/nodejs/@rjsf/core/lib/index.js line 1):

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.
    at /usr/share/nodejs/webpack/lib/NormalModule.js:984:10
    at Hook.eval [as callAsync] (eval at create (/usr/share/nodejs/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/usr/share/nodejs/tapable/lib/Hook.js:18:14)
    at Object.processResource (/usr/share/nodejs/webpack/lib/NormalModule.js:980:8)
    at processResource (/usr/share/nodejs/loader-runner/lib/LoaderRunner.js:220:11)
    at iteratePitchingLoaders (/usr/share/nodejs/loader-runner/lib/LoaderRunner.js:171:10)
    at runLoaders (/usr/share/nodejs/loader-runner/lib/LoaderRunner.js:398:2)
    at NormalModule._doBuild (/usr/share/nodejs/webpack/lib/NormalModule.js:965:3)
    at NormalModule.build (/usr/share/nodejs/webpack/lib/NormalModule.js:1155:15)
    at /usr/share/nodejs/webpack/lib/Compilation.js:1422:12
 @ ../../../../../../../../../usr/share/nodejs/@rjsf/core/lib/index.js 1:0-40 44141:4-29 44144:4-29
 @ ../../../../../../../../../usr/share/nodejs/@jupyterlab/ui-components/lib/components/form.js 7:0-30 281:32-36
 @ ../../../../../../../../../usr/share/nodejs/@jupyterlab/ui-components/lib/components/index.js 5:0-23 5:0-23
 @ ../../../../../../../../../usr/share/nodejs/@jupyterlab/ui-components/lib/index.js 7:0-29 7:0-29
 @ ../../../../../../../../../usr/share/nodejs/@jupyterlab/apputils/lib/index.js 7:0-65 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 13:0-296 39:29-38 50:31-57
 @ ./src/app/diff.ts 6:0-49 39:23-32
 @ ./src/index.ts 4:0-44 36:8-22


Following the webpack documentation, I've patched webpack.config.js to
include a resolve.fallback clause (and included the
(node-)crypto-browserify package in extlinks):

  resolve: {
    // Add '.ts' as resolvable extension.
    extensions: ['.webpack.js', '.web.js', '.ts', '.js'],
    fallback: {
      crypto: require.resolve('crypto-browserify'),
      stream: require.resolve('stream-browserify'),
    },
  },

But to no avail - the build still fails.

Any idea what I should do to fix this?


The problem is most probably because the webpack resolver does not know how to resolve the "node:" prefix.
I dealt with a similar issue in the last six months, but I can't remember where :(

Reply to: