aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-09-02 05:11:45 +0200
committerVendicated <vendicated@riseup.net>2022-09-02 05:11:45 +0200
commit5488f5cecb0be8d1ffaefdd488b34e599ae198d9 (patch)
tree0181acacd04f4bd227d57aa1e7a3e95a3dfd7e3c /src
parent138682f3eb28cfc76ef8cb5128f2537f00821e90 (diff)
downloadVencord-5488f5cecb0be8d1ffaefdd488b34e599ae198d9.tar.gz
Vencord-5488f5cecb0be8d1ffaefdd488b34e599ae198d9.tar.bz2
Vencord-5488f5cecb0be8d1ffaefdd488b34e599ae198d9.zip
Better patch errors
Diffstat (limited to 'src')
-rw-r--r--src/utils/patchWebpack.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/utils/patchWebpack.ts b/src/utils/patchWebpack.ts
index dffce86..9ae9fbf 100644
--- a/src/utils/patchWebpack.ts
+++ b/src/utils/patchWebpack.ts
@@ -6,7 +6,6 @@ let webpackChunk: any[];
const logger = new Logger("WebpackInterceptor", "#8caaee");
-
Object.defineProperty(window, WEBPACK_CHUNK, {
get: () => webpackChunk,
set: (v) => {
@@ -87,12 +86,16 @@ function patchPush() {
logger.warn(`Patch by ${patch.plugin} had no effect: ${replacement.match}`);
logger.debug("Function Source:\n", code);
} else {
- const newMod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`);
code = newCode;
- mod = newMod;
+ mod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`);
}
} catch (err) {
+ // TODO - More meaningful errors. This probably means moving away from string.replace
+ // in favour of manual matching. Then cut out the context and log some sort of
+ // diff
logger.error("Failed to apply patch of", patch.plugin, err);
+ logger.debug("Original Source\n", lastCode);
+ logger.debug("Patched Source\n", code);
code = lastCode;
mod = lastMod;
patchedBy.delete(patch.plugin);