INNER CODE UNIT · JavaScript
unknown
o19s/quepid · esbuild.config.js:55
const unknown = names.filter((name) => !BUNDLES[name]);
if (names.length === 0 || unknown.length > 0) {
console.error(`Usage: node esbuild.config.js <${Object.keys(BUNDLES).join('|')}>... [--watch]`);
process.exit(1);
}
const contexts = await Promise.all(
names.map((name) => esbuild.context({ ...SHARED, ...BUNDLES[name], logLevel: 'info' }))
);
if (watch) {
await Promise.all(contexts.map((ctx) => ctx.watch()));
return; // watchers keep the process alive
}
// allSettled lets every bundle finish before disposing; esbuild has already logged errors.
const results = await Promise.allSettled(contexts.map((ctx) => ctx.rebuild()));
if (results.some((result) => result.status === 'rejected')) process.exitCode = 1;