Skip to content

Commit e1fc3d1

Browse files
committed
chore: revert ESM exec mode experiment, keep all other fixes
1 parent ee385b9 commit e1fc3d1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/nodejs/src/execution-driver.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,13 @@ export class NodeExecutionDriver implements RuntimeDriver {
10411041
// through the bridge. Dynamic import() in CJS mode goes through the
10421042
// require-setup's __dynamicImportHandler which uses _requireFrom and
10431043
// properly resolves packages via the bridge.
1044+
// For ESM entry scripts loaded from module access overlay paths,
1045+
// use CJS exec mode with a dynamic import() wrapper instead of V8's
1046+
// native ESM "run" mode. The native ESM resolver makes a synchronous
1047+
// IPC call per import, which is prohibitively slow for packages with
1048+
// large dependency trees (e.g., PI has hundreds of @sinclair/typebox
1049+
// sub-modules). CJS mode uses the in-process require-setup transform
1050+
// which is orders of magnitude faster.
10441051
const sessionMode = options.mode === "run" || entryIsEsm ? "run" : "exec";
10451052
const userCode = entryIsEsm
10461053
? options.code

0 commit comments

Comments
 (0)