Open egoist opened 2 years ago
it would be nice to have for DTS builds since tsc is sloooooow
I've made an ugly but functional workaround because DTS was too slow:
// tsup.config.ts
import {spawnSync} from 'child_process';
export default {
// your config
dts: false,
async onSuccess() {
spawnSync('tsc', ['--emitDeclarationOnly', '--declaration']);
},
}
To make this an incremental build, you should have incremental: true
in the relevant tsconfig.json
, or pass it in spawnSync.
We want this feature, as esbuild already supports it: https://github.com/evanw/esbuild/pull/2816.
In our case, we have some interface generation processes to execute before other esbuild processes, but currently, we have to execute every file, which is very slow. Ideally, we would only handle the changed files, making it much faster.
By the way, thank you for your great job!
I've made an ugly but functional workaround because DTS was too slow:
// tsup.config.ts import {spawnSync} from 'child_process'; export default { // your config dts: false, async onSuccess() { spawnSync('tsc', ['--emitDeclarationOnly', '--declaration']); }, }
To make this an incremental build, you should have
incremental: true
in the relevanttsconfig.json
, or pass it in spawnSync.
@EdieLemoine Proxying the declaration builds to a separate tsc
process directly works great, thank you so much! Cut my build times down substantially.
Do you have any clean methods to bundle up the .d.ts
files into a single .d.ts
file per entry point like tsup
does by default, or do you just keep them separate? I tried a few packages, such as dts-bundle-generator and rollup-plugin-ts itself without luck.
esbuild is so fast that I forgot this is not yet implemented in tsup.
Upvote & Fund