diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js index c77ee9b107e0ad..d9a073fd4d7906 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -7,6 +7,7 @@ const { ArrayPrototypeIndexOf, ArrayPrototypeSome, ObjectDefineProperty, + ObjectFreeze, ObjectGetPrototypeOf, ObjectSetPrototypeOf, ReflectApply, @@ -340,9 +341,7 @@ class SourceTextModule extends Module { if (this[kWrap] === undefined) { throw new ERR_VM_MODULE_NOT_MODULE(); } - if (this[kDependencySpecifiers] === undefined) { - this[kDependencySpecifiers] = this[kWrap].getStaticDependencySpecifiers(); - } + this[kDependencySpecifiers] ??= ObjectFreeze(this[kWrap].getStaticDependencySpecifiers()); return this[kDependencySpecifiers]; }