File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments