diff options
author | Vendicated <vendicated@riseup.net> | 2022-11-01 14:27:13 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-11-01 14:28:25 +0100 |
commit | 64aed87de41ecc614f742f999989f32e42826ea2 (patch) | |
tree | 5957174af6f7ed48cc9bab06bfef40b6ddf81633 /src/webpack | |
parent | 1944f3957fb8113b610a4e281d75ee36ac97a422 (diff) | |
download | Vencord-64aed87de41ecc614f742f999989f32e42826ea2.tar.gz Vencord-64aed87de41ecc614f742f999989f32e42826ea2.tar.bz2 Vencord-64aed87de41ecc614f742f999989f32e42826ea2.zip |
Fix Webpack modules that are not arrow funcs
Diffstat (limited to 'src/webpack')
-rw-r--r-- | src/webpack/patchWebpack.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index b3cfd70..fa6767c 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -57,6 +57,11 @@ function patchPush() { // ever targets newer browsers, the minifier could potentially use this trick and // cause issues. let code: string = mod.toString().replaceAll("\n", ""); + // a very small minority of modules use function() instead of arrow functions, + // but, unnamed toplevel functions aren't valid. Thus, give those a name + if (code.startsWith("function(")) { + code = "function patchedModule" + code.slice("function".length); + } const originalMod = mod; const patchedBy = new Set(); |