aboutsummaryrefslogtreecommitdiff
path: root/src/webpack
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-11 12:37:37 +0100
committerVendicated <vendicated@riseup.net>2022-11-11 12:37:37 +0100
commita26f636c9b422f866b0dbe42566cd90c256483d1 (patch)
tree5bbe016b7053f8b48f7b0d73d422c2a4c7657008 /src/webpack
parent8ba9c96f2075f5245a9fec369046559d6a1e107c (diff)
downloadVencord-a26f636c9b422f866b0dbe42566cd90c256483d1.tar.gz
Vencord-a26f636c9b422f866b0dbe42566cd90c256483d1.tar.bz2
Vencord-a26f636c9b422f866b0dbe42566cd90c256483d1.zip
ci: Automated plugin test with puppeteer
Diffstat (limited to 'src/webpack')
-rw-r--r--src/webpack/patchWebpack.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts
index 679d481..f14ab0b 100644
--- a/src/webpack/patchWebpack.ts
+++ b/src/webpack/patchWebpack.ts
@@ -65,7 +65,7 @@ function patchPush() {
const originalMod = mod;
const patchedBy = new Set();
- modules[id] = function (module, exports, require) {
+ const factory = modules[id] = function (module, exports, require) {
try {
mod(module, exports, require);
} catch (err) {
@@ -118,10 +118,14 @@ function patchPush() {
logger.error("Error while firing callback for webpack chunk", err);
}
}
- };
+ } as any as { toString: () => string, original: any, (...args: any[]): void; };
- modules[id].toString = () => mod.toString();
- modules[id].original = originalMod;
+ // for some reason throws some error on which calling .toString() leads to infinite recursion
+ // when you force load all chunks???
+ try {
+ factory.toString = () => mod.toString();
+ factory.original = originalMod;
+ } catch { }
for (let i = 0; i < patches.length; i++) {
const patch = patches[i];
@@ -147,7 +151,7 @@ function patchPush() {
mod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`);
}
} catch (err) {
- logger.error(`Failed to apply patch ${replacement.match} of ${patch.plugin} to ${id}:\n`, err);
+ logger.error(`Patch by ${patch.plugin} errored (Module id is ${id}): ${replacement.match}\n`, err);
if (IS_DEV) {
const changeSize = code.length - lastCode.length;