Skip to content

Commit

Permalink
core/patch: Don't patch module if it's been replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Jan 22, 2025
1 parent 9c53811 commit fda1f08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function patchModules(entry: WebpackJsonpEntry[1]) {
const patchedStr = [];
const mappedName = moonlight.moonmap.modules[id];
let modified = false;
let swappedModule = false;

const exts = new Set<string>();

Expand Down Expand Up @@ -165,6 +166,7 @@ function patchModules(entry: WebpackJsonpEntry[1]) {
entry[id] = newModule;
entry[id].__moonlight = true;
replaced = newModule.toString().replace(/\n/g, "");
swappedModule = true;
}
}

Expand All @@ -180,7 +182,7 @@ function patchModules(entry: WebpackJsonpEntry[1]) {
}

if (modified) {
patchModule(id, patchedStr.join(", "), moduleString);
if (!swappedModule) patchModule(id, patchedStr.join(", "), moduleString);
moduleCache[id] = moduleString;
moonlight.patched.set(id, exts);
}
Expand Down

0 comments on commit fda1f08

Please sign in to comment.