Fix Webpack modules that are not arrow funcs

This commit is contained in:
Vendicated 2022-11-01 14:27:13 +01:00
parent 1944f3957f
commit 64aed87de4
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
2 changed files with 6 additions and 1 deletions

View file

@ -119,7 +119,7 @@ function ReplacementComponent({ module, match, replacement, setReplacementError
{!!diff?.length && (
<Button className={Margins.marginTop20} onClick={() => {
try {
Function(patchedCode);
Function(patchedCode.replace(/^function\(/, "function patchedModule("));
setCompileResult([true, "Compiled successfully"]);
} catch (err) {
setCompileResult([false, (err as Error).message]);