Add track-specific conversion options, fix esbuild race condition

This commit is contained in:
Vanilagy
2025-08-11 00:00:04 +02:00
parent 975c1c42cb
commit 11c15c2392
6 changed files with 323 additions and 214 deletions
+5
View File
@@ -71,13 +71,18 @@ if (cacheDir === undefined) {
throw new Error('Cache directory not found.');
}
let i = 0;
async function buildWorker(workerPath: string, extraConfig: esbuild.BuildOptions) {
const scriptNameParts = path.basename(workerPath).split('.');
scriptNameParts.pop();
scriptNameParts.push(String(i)); // To make sure it doesn't clash with other builds
scriptNameParts.push('js');
const scriptName = scriptNameParts.join('.');
const bundlePath = path.resolve(cacheDir!, scriptName);
i = (i + 1) % 32;
if (extraConfig) {
delete extraConfig.entryPoints;
delete extraConfig.outfile;