When I call __dirname
in tsc or tsx its value is the current directory. But in tsup the value is the entrypoint directory.
Example:
Suppose there is a project where the entry point is /home/project/src/server/index.ts:
import '../modules/example'
And the file /home/project/src/modules/example.ts:
console.log(__dirname)
When I build from tsc or run using tsx, the result is:
/home/project/dist/modules/
But when I build from tsup the result is:
/home/project/dist/server
Is there a way to get same result from tsc and tsx?
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