egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.46k stars 209 forks source link

fix: Replace parentPort.close() with process.exit() in worker thread #1140

Open valentinpalkovic opened 3 weeks ago

valentinpalkovic commented 3 weeks ago

This change ensures the worker thread signals the parent process to exit in the bun runtime environment. Previously, the parent process would continue running indefinitely due to an unclear issue with worker thread termination. This fix ensures a clean exit after the worker thread has completed its tasks.

Context:

This bug stops us from fully migrating to the bun runtime for the Storybook mono repo without additional workarounds.

Reproduction:

Run tsup programmatically in a bun runtime instead of Node.js and define some DTS options so that the rollup worker thread spawns. With this fix, after building the DTS assets, the process exits successfully. Before, the process never exited.

codesandbox[bot] commented 3 weeks ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tsup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2024 9:44am