aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/CommonJSModuleRecord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/CommonJSModuleRecord.cpp')
-rw-r--r--src/bun.js/bindings/CommonJSModuleRecord.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp
index a32d722d9..dc58e35aa 100644
--- a/src/bun.js/bindings/CommonJSModuleRecord.cpp
+++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp
@@ -391,8 +391,12 @@ JSC::SourceCode createCommonJSModule(
// to pass to that and it isn't used directly much, so that
// seems harder to do correctly.
{
+ globalObject->clearGlobalScopeExtension();
+
JSWithScope* withScope = JSWithScope::create(vm, globalObject, globalObject->globalScope(), scopeExtensionObject);
- vm.interpreter.executeEval(executable, globalObject, withScope);
+ globalObject->setGlobalScopeExtension(withScope);
+ vm.interpreter.executeEval(executable, globalObject, globalObject->globalScope());
+ globalObject->clearGlobalScopeExtension();
if (UNLIKELY(catchScope.exception())) {
auto returnedException = catchScope.exception();