diff --git a/lib/internal/bootstrap/realm.js b/lib/internal/bootstrap/realm.js index 0ebec1c02d0c0d..9cb6a8add714d0 100644 --- a/lib/internal/bootstrap/realm.js +++ b/lib/internal/bootstrap/realm.js @@ -198,6 +198,9 @@ const { setInternalLoaders, } = internalBinding('builtins'); +const { ModuleWrap } = internalBinding('module_wrap'); +ObjectSetPrototypeOf(ModuleWrap.prototype, null); + const getOwn = (target, property, receiver) => { return ObjectPrototypeHasOwnProperty(target, property) ? ReflectGet(target, property, receiver) : @@ -338,16 +341,11 @@ class BuiltinModule { const internal = StringPrototypeStartsWith(this.id, 'internal/'); this.exportKeys = internal ? [] : ObjectKeys(this.exports); } - this.getESMFacade(); - this.syncExports(); return this.exports; } getESMFacade() { if (this.module) return this.module; - const { ModuleWrap } = internalBinding('module_wrap'); - // TODO(aduh95): move this to C++, alongside the initialization of the class. - ObjectSetPrototypeOf(ModuleWrap.prototype, null); const url = `node:${this.id}`; const builtin = this; const exportsKeys = ArrayPrototypeSlice(this.exportKeys);