aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/CommonJSModuleRecord.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-06-02 04:01:25 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-02 04:01:25 -0700
commit97c522517c5dc631d77f035f0c5ae089ba0068aa (patch)
treecbff1047c7438c71d649fee3e9aa8fa398515d71 /src/bun.js/bindings/CommonJSModuleRecord.cpp
parent4c6245b2e5788ac46e31bf67beefab8cdadebedb (diff)
downloadbun-97c522517c5dc631d77f035f0c5ae089ba0068aa.tar.gz
bun-97c522517c5dc631d77f035f0c5ae089ba0068aa.tar.zst
bun-97c522517c5dc631d77f035f0c5ae089ba0068aa.zip
Fixes #3161 (#3174)
* Fixes #3161 * Fix the error message * woops --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
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();