Fix(Preview): Fixed code pollution bug

Methods and variables in base and main code are isolated to solve the problem of code pollution. Close #4
This commit is contained in:
2024-09-09 16:24:22 +08:00
parent bba90c6783
commit 51ee15749e
7 changed files with 129 additions and 131 deletions

View File

@@ -27,7 +27,7 @@ const Execute = () => {
const output = result.outputFiles[0].text
setCompiledCode('')
setTimeout(() => {
setCompiledCode(`${output}\n${baseDist}`)
setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`)
}, 100)
})
.catch((reason) => {