Skip to content

Commit 8317c80

Browse files
committed
🐞 fix: Fix improper memory span in Node.js mode
1 parent 69a6372 commit 8317c80

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: cpp/jni/javet_jni_module.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,17 @@ JNIEXPORT jobject JNICALL Java_com_caoccao_javet_interop_V8Native_moduleCreate
7777
}
7878
}
7979
}
80+
#ifndef ENABLE_NODE
8081
v8::MemorySpan<const V8LocalString> exportNamesMemorySpan(exportNames.begin(), exportNames.end());
82+
#endif
8183
auto v8LocalModule = v8::Module::CreateSyntheticModule(
8284
v8Context->GetIsolate(),
8385
Javet::Converter::ToV8String(jniEnv, v8Context, mModuleName),
86+
#ifdef ENABLE_NODE
87+
exportNames,
88+
#else
8489
exportNamesMemorySpan,
90+
#endif
8591
Javet::Callback::JavetSyntheticModuleEvaluationStepsCallback);
8692
std::string stringKey("module:{}" + std::to_string(v8LocalModule->GetIdentityHash()));
8793
auto v8LocalStringKey = Javet::Converter::ToV8String(v8Context, stringKey.c_str());

0 commit comments

Comments
 (0)