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;
}
const assetPath = stack.match(/\/assets\/.+?\.js/)?.[0];
const assetPath = stack.match(/http.+?\.js/)?.[0];
if (!assetPath) {
return;
}

View file

@ -68,7 +68,7 @@ define(Function.prototype, "m", {
define(this, "e", { value: ensureChunk });
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);
}
});
@ -280,7 +280,7 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
// There are (at the time of writing) 11 modules exporting the window
// Make these non enumerable to improve webpack search performance
if (typeof require === "function" && require.c != null) {
if (typeof require === "function") {
let foundWindow = false;
if (exports === window) {
@ -298,12 +298,14 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
}
if (foundWindow) {
if (require.c != null) {
Object.defineProperty(require.c, id, {
value: require.c[id],
enumerable: false,
configurable: true,
writable: true
});
}
return factoryReturn;
}