egoist / tsup

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

`--experimental-dts` not working well with `--clean` flag #1040

Closed 0x-jerry closed 7 months ago

0x-jerry commented 7 months ago

Reproduce: https://stackblitz.com/edit/vitejs-vite-q3cget?file=package.json

When run pnpm run build (tsup src/main.ts --experimental-dts main --format esm), it works well. The generate result is: image

But when run pnpm run build-with-clean (tsup src/main.ts --experimental-dts main --format esm --clean), it will not generate dts files. The generate result is: image

0x-jerry commented 7 months ago

I have took a look at the source code, it seems the dts task executed before main task, but the main task only checked dts option.

https://github.com/egoist/tsup/blob/d8a203c6617afe7d3fa7fe211c4182538b0acad6/src/index.ts#L294-L306