core/patch: Don't patch module if it's been replaced
Changed files
MODIFIED
packages/core/src/patch.ts
MODIFIED
packages/core/src/patch.ts
@@ -110,6 +110,7 @@ let moduleString = origModuleString;const patchedStr = [];const mappedName = moonlight.moonmap.modules[id];let modified = false;+ let swappedModule = false;const exts = new Set<string>();@@ -165,6 +166,7 @@ const newModule = replace.replacement(replaced);entry[id] = newModule;entry[id].__moonlight = true;replaced = newModule.toString().replace(/\n/g, "");+ swappedModule = true;}}@@ -180,7 +182,7 @@ }}if (modified) {- patchModule(id, patchedStr.join(", "), moduleString);+ if (!swappedModule) patchModule(id, patchedStr.join(", "), moduleString);moduleCache[id] = moduleString;moonlight.patched.set(id, exts);}