fix: 添加输出编译报错信息
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user