From 13c73699e98196ae57dd5fbd9ee5e47366055ab3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 1 Nov 2022 15:06:15 +0100 Subject: Fix Webpack modules that are not arrow funcs, Part II --- src/webpack/patchWebpack.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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(); -- cgit