From 332f3e532ba0ff861570f73c35be6044e39204f0 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 29 Jun 2024 02:21:44 -0300 Subject: [PATCH] Dont depend on modules being an object again --- src/webpack/patchWebpack.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 55425431f..eca02dc49 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -48,7 +48,7 @@ define(Function.prototype, "m", { // We may also catch Discord bundled libs, React Devtools or other extensions WebpackInstance here. // This ensures we actually got the right ones const { stack } = new Error(); - if (!(stack?.includes("discord.com") || stack?.includes("discordapp.com")) || Array.isArray(originalModules)) { + if (!(stack?.includes("discord.com") || stack?.includes("discordapp.com")) || (stack != null ? /at \d+? \(/.test(stack) : true) || !String(this).includes("exports:{}")) { return; } @@ -66,7 +66,7 @@ define(Function.prototype, "m", { define(this, "p", { value: bundlePath }); clearTimeout(setterTimeout); - if (bundlePath !== "/assets/") return; + if (window.GLOBAL_ENV?.PUBLIC_PATH != null && bundlePath !== window.GLOBAL_ENV.PUBLIC_PATH) return; logger.info("Main Webpack found" + interpolateIfDefined` in ${fileName}` + ", initializing internal references to WebpackRequire"); _initWebpack(this);