Compiler robustness
This commit is contained in:
parent
0b46d5c7d9
commit
0388b6a2a4
@ -28,6 +28,7 @@ export async function compile(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// TODO: Figure out how to make source maps work correctly with eval() code
|
// TODO: Figure out how to make source maps work correctly with eval() code
|
||||||
let result = await esbuild.build({
|
let result = await esbuild.build({
|
||||||
entryPoints: [path.basename(inFile)],
|
entryPoints: [path.basename(inFile)],
|
||||||
@ -50,10 +51,12 @@ export async function compile(
|
|||||||
|
|
||||||
let jsCode = (await readFile(outFile)).toString();
|
let jsCode = (await readFile(outFile)).toString();
|
||||||
await unlink(outFile);
|
await unlink(outFile);
|
||||||
|
return `(() => { ${jsCode} return mod;})()`;
|
||||||
|
} finally {
|
||||||
if (inFile !== filePath) {
|
if (inFile !== filePath) {
|
||||||
await unlink(inFile);
|
await unlink(inFile);
|
||||||
}
|
}
|
||||||
return `(() => { ${jsCode} return mod;})()`;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function compileModule(
|
export async function compileModule(
|
||||||
|
Loading…
Reference in New Issue
Block a user