We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 81e91c1 commit ee385b9Copy full SHA for ee385b9
1 file changed
packages/nodejs/src/execution-driver.ts
@@ -1035,6 +1035,12 @@ export class NodeExecutionDriver implements RuntimeDriver {
1035
options.code,
1036
options.filePath,
1037
);
1038
+ // For ESM entry scripts, wrap in a CJS dynamic import() launcher instead
1039
+ // of using V8's native ESM "run" mode. The native ESM module resolver in
1040
+ // the V8 isolate doesn't resolve non-builtin packages (undici, chalk, etc.)
1041
+ // through the bridge. Dynamic import() in CJS mode goes through the
1042
+ // require-setup's __dynamicImportHandler which uses _requireFrom and
1043
+ // properly resolves packages via the bridge.
1044
const sessionMode = options.mode === "run" || entryIsEsm ? "run" : "exec";
1045
const userCode = entryIsEsm
1046
? options.code
0 commit comments