fix: 添加输出编译报错信息

This commit is contained in:
tianyu
2024-02-10 15:09:38 +08:00
parent 3b8e1c2ca2
commit b41e0ce8ed
2 changed files with 2 additions and 5 deletions
+1 -1
View File
@@ -66,7 +66,7 @@
const init = async () => {
const code = await compiler.compile('/main.tsx')
console.log(code)
// 编译报错详细信息
// 编译报错信息
if(typeof code !== 'string' && code.error) {
document.querySelector('#root').innerHTML = code.message
return
+1 -4
View File
@@ -65,10 +65,7 @@ export class Compiler {
})
}
public async compile(entryPoint: string, options: esbuild.BuildOptions = {}): Promise<string | {
error: boolean;
message: string
}> {
public async compile(entryPoint: string, options: esbuild.BuildOptions = {}) {
while (!this.initialized) {
// Wait until initialization is complete
await new Promise(resolve => setTimeout(resolve, 16))