this repo has no description

core/patch: Only insert into module cache if module was patched

This prevents patches that result in invalid JavaScript syntax from
hard-crashing the client. Noticed this issue with quietLoggers.

Changed files
+3 -2
packages
core
src
+3 -2
packages/core/src/patch.ts
···
}
if (modified) {
-
if (!swappedModule) patchModule(id, patchedStr.join(", "), moduleString, entry);
-
moduleCache[id] = moduleString;
moonlight.patched.set(id, exts);
}
···
}
if (modified) {
+
let shouldCache = true;
+
if (!swappedModule) shouldCache = patchModule(id, patchedStr.join(", "), moduleString, entry);
+
if (shouldCache) moduleCache[id] = moduleString;
moonlight.patched.set(id, exts);
}