fix error spam in non app discord websites

This commit is contained in:
Nuckyz 2024-08-03 17:11:03 -03:00
parent b22d4622ed
commit 9871e16e28
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 11 additions and 9 deletions

View file

@ -97,7 +97,7 @@ export default definePlugin({
return; return;
} }
const assetPath = stack.match(/\/assets\/.+?\.js/)?.[0]; const assetPath = stack.match(/http.+?\.js/)?.[0];
if (!assetPath) { if (!assetPath) {
return; return;
} }

View file

@ -68,7 +68,7 @@ define(Function.prototype, "m", {
define(this, "e", { value: ensureChunk }); define(this, "e", { value: ensureChunk });
clearTimeout(setterTimeout); clearTimeout(setterTimeout);
logger.info("Main Webpack found" + interpolateIfDefined` in ${fileName}` + ", initializing internal references to WebpackRequire"); logger.info("Main WebpackInstance found" + interpolateIfDefined` in ${fileName}` + ", initializing internal references to WebpackRequire");
_initWebpack(this); _initWebpack(this);
} }
}); });
@ -280,7 +280,7 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
// There are (at the time of writing) 11 modules exporting the window // There are (at the time of writing) 11 modules exporting the window
// Make these non enumerable to improve webpack search performance // Make these non enumerable to improve webpack search performance
if (typeof require === "function" && require.c != null) { if (typeof require === "function") {
let foundWindow = false; let foundWindow = false;
if (exports === window) { if (exports === window) {
@ -298,12 +298,14 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
} }
if (foundWindow) { if (foundWindow) {
Object.defineProperty(require.c, id, { if (require.c != null) {
value: require.c[id], Object.defineProperty(require.c, id, {
enumerable: false, value: require.c[id],
configurable: true, enumerable: false,
writable: true configurable: true,
}); writable: true
});
}
return factoryReturn; return factoryReturn;
} }