Not needed anymore and breaks interpolated strings with newlines

This commit is contained in:
Nuckyz 2024-05-31 00:21:15 -03:00
parent 022a0497c3
commit 47eec049fc
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -211,16 +211,8 @@ function patchFactory(id: PropertyKey, factory: ModuleFactory) {
const patchedBy = new Set<string>(); const patchedBy = new Set<string>();
// Discords Webpack chunks for some ungodly reason contain random // 0, prefix to turn it into an expression: 0,function(){} would be invalid syntax without the 0,
// newlines. Cyn recommended this workaround and it seems to work fine, let code: string = "0," + String(factory);
// however this could potentially break code, so if anything goes weird,
// this is probably why.
// Additionally, `[actual newline]` is one less char than "\n", so if Discord
// ever targets newer browsers, the minifier could potentially use this trick and
// cause issues.
//
// 0, prefix is to turn it into an expression: 0,function(){} would be invalid syntax without the 0,
let code: string = "0," + String(factory).replaceAll("\n", "");
for (let i = 0; i < patches.length; i++) { for (let i = 0; i < patches.length; i++) {
const patch = patches[i]; const patch = patches[i];