diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index fa6767c..679d481 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -58,9 +58,9 @@ function patchPush() { // 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 + // but, unnamed toplevel functions aren't valid. However 0, function() makes it a statement if (code.startsWith("function(")) { - code = "function patchedModule" + code.slice("function".length); + code = "0," + code; } const originalMod = mod; const patchedBy = new Set();