Skip to content

Commit

Permalink
[unity]如果加载依赖的module失败,应该从cache中移除,fix #1670
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Mar 20, 2024
1 parent 2b1ae7f commit 9515114
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion unity/native_src/Src/BackendEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,19 @@ bool puerts::esmodule::LinkModule(
}
if (!isFromCache)
{
if (!LinkModule(Context, MaybeModule.ToLocalChecked()))
v8::Local<v8::Module> Module = MaybeModule.ToLocalChecked();
if (!LinkModule(Context, Module))
{
puerts::BackendEnv* mm = puerts::BackendEnv::Get(Isolate);

#if V8_94_OR_NEWER
auto Specifier_std = mm->ScriptIdToPathMap[Module->ScriptId()];
mm->ScriptIdToPathMap.erase(Module->ScriptId());
#else
auto Specifier_std = = mm->ScriptIdToPathMap[Module->GetIdentityHash()];
mm->ScriptIdToPathMap.erase(Module->GetIdentityHash());
#endif
mm->PathToModuleMap.erase(Specifier_std);
return false;
}
}
Expand Down

0 comments on commit 9515114

Please sign in to comment.