Skip to content

Commit bda370f

Browse files
committed
sea: use wrapModuleLoad for VFS module loading
Use wrapModuleLoad instead of Module._load directly to ensure diagnostics channels and performance tracing work properly when loading modules from SEA VFS.
1 parent a18f948 commit bda370f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/main/embedding.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
const { isExperimentalSeaWarningNeeded, isSea } = internalBinding('sea');
1616
const { emitExperimentalWarning } = require('internal/util');
1717
const { emitWarningSync } = require('internal/process/warning');
18-
const { Module } = require('internal/modules/cjs/loader');
18+
const { Module, wrapModuleLoad } = require('internal/modules/cjs/loader');
1919
const { compileFunctionForCJSLoader } = internalBinding('contextify');
2020
const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache');
2121
const { BuiltinModule } = require('internal/bootstrap/realm');
@@ -161,8 +161,8 @@ function embedderRequire(id) {
161161

162162
// Check if the file exists in VFS
163163
if (seaVfs.existsSync(modulePath)) {
164-
// Use Module._load to load the module, which will use VFS hooks
165-
return Module._load(modulePath, embedderRequire.main, false);
164+
// Use wrapModuleLoad to load the module with proper tracing/diagnostics
165+
return wrapModuleLoad(modulePath, embedderRequire.main, false);
166166
}
167167
}
168168
}

0 commit comments

Comments
 (0)