This issue is the same as the one in esbuild #638 and was fixed there. I have tested my codebase using raw esbuild and the issue is not present there.
Basically, the problem is that line numbers are wrong in source maps therefore in stack traces.
You can reproduce using this repo https://github.com/Floffah/crossant/tree/tsup-problems/packages/bot
it seems this only happens when using splitting
Expected (using esbuild):
the error was created on this line
https://github.com/Floffah/crossant/blob/tsup-problems/packages/bot/src/sharding/AppManager.ts#L97
(i know i forgot to minify, however if i minify it the line number is still correct here)
What really happens (with tsup):
the tsup sourcemap points to this line
https://github.com/Floffah/crossant/blob/tsup-problems/packages/bot/src/sharding/AppManager.ts#L188
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too