Closed
Description
Version
20.0.0 (tested on main at 36e4e3d too)
Platform
macOS but probably all platforms
Subsystem
esm
What steps will reproduce the bug?
The following works in Node 18 and 19, but not 20:
// main.mjs
import { Worker } from 'node:worker_threads';
new Worker('./worker.js', {
execArgv: ['--experimental-loader', './loader.mjs'],
});
// worker.js
'use strict';
async function main() {
await import('node:fs');
}
main();
// loader.mjs
export function resolve (specifier, context, nextResolve) {
throw new Error('boom');
}
Run: node main.mjs
. In Node 18 and 19, the exception in the loader is thrown. In Node 20 it is not. The problem is not unique to throwing. I haven't been able to see console.log()
or any other indication that the loader is being called.
How often does it reproduce? Is there a required condition?
100% of the time for me.
What is the expected behavior? Why is that the expected behavior?
I expect it to work as it did in earlier versions of Node. This is the expected behavior because right now it doesn't seem to work at all.
What do you see instead?
See the description of the bug above.
Additional information
Just a guess, but I'm assuming this is related to #44710.