In a mocha test I use readable-stream and I got this ``` Error: Cannot find module '../crypto/util' Require stack: - packages/formats/node_modules/readable-stream/lib/internal/streams/lazy_transform.js ``` I did not find why it gets loaded but the fact is there is no `crypto/util.js` or similar module.
Activity
mcollina commentedon May 4, 2023
how do you load
lazy_transform.js?tpluscode commentedon May 4, 2023
That's kinda the thing, I don't.
There are only 2 mentions of
lazy_transformin my entire working directorytpluscode commentedon May 10, 2023
Any ideas? For now I patched this locally but again, why is that module trying to import
../crypto/util.jswhich does not exist?kanongil commentedon May 10, 2023
The main issue seems to be that
readable-streamincludes a broken-on-require unused internal module (lazy_transform).This is a problem since bundlers / transpilers / test runners can sometimes recursively load all
**.jsmodules, as is likely happening here.mcollina commentedon May 15, 2023
lazy_transformshould be skipped when we build this module from Node.js core source.Adding it to this list would do: https://github.com/nodejs/readable-stream/blob/main/build/files.mjs
Would you like to send a PR? Ideally it should contain a unit test for this issue so we do not regress.