diff options
Diffstat (limited to 'lib/internal/modules/cjs/helpers.js')
-rw-r--r-- | lib/internal/modules/cjs/helpers.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/internal/modules/cjs/helpers.js b/lib/internal/modules/cjs/helpers.js index b75f67c0a4..f7155c4aa1 100644 --- a/lib/internal/modules/cjs/helpers.js +++ b/lib/internal/modules/cjs/helpers.js @@ -1,6 +1,9 @@ 'use strict'; -const { Object, SafeMap } = primordials; +const { + ObjectDefineProperty, + SafeMap, +} = primordials; const { ERR_MANIFEST_DEPENDENCY_MISSING, ERR_UNKNOWN_BUILTIN_MODULE @@ -135,14 +138,14 @@ function addBuiltinLibsToObject(object) { object[name] = val; }; - Object.defineProperty(object, name, { + ObjectDefineProperty(object, name, { get: () => { const lib = require(name); // Disable the current getter/setter and set up a new // non-enumerable property. delete object[name]; - Object.defineProperty(object, name, { + ObjectDefineProperty(object, name, { get: () => lib, set: setReal, configurable: true, |