diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index f131471bf..db47c875a 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -58,6 +58,9 @@ if (window[WEBPACK_CHUNK]) { // normally, this is populated via webpackGlobal.push, which we patch below. // However, Discord has their .m prepopulated. // Thus, we use this hack to immediately access their wreq.m and patch all already existing factories + // + // Update: Discord now has TWO webpack instances. Their normal one and sentry + // Sentry does not push chunks to the global at all, so this same patch now also handles their sentry modules Object.defineProperty(Function.prototype, "m", { set(v: any) { // When using react devtools or other extensions, we may also catch their webpack here. @@ -65,8 +68,6 @@ if (window[WEBPACK_CHUNK]) { if (new Error().stack?.includes("discord.com")) { logger.info("Found webpack module factory"); patchFactories(v); - - delete (Function.prototype as any).m; } Object.defineProperty(this, "m", { @@ -142,7 +143,7 @@ function patchFactories(factories: Record