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 and Multi-entrypoint builds #1046

Open jacob-alford opened 7 months ago

jacob-alford commented 7 months ago

I really like the option to use @microsoft/api-extractor for DTS types. However, it doesn't work for all cases. It seems that it's currently only built for single entrypoint builds, see this section here:

https://api-extractor.com/pages/setup/configure_rollup/#an-important-limitation

And another thing, it doesn't seem to be copying the emitted dts files into the dist directory, even though it seems that it should be.

I also wanted to comment, Tsup is an incredible library and it's made building esm/cjs libs a breeze. Thank you very much for your work 🙏🏻

Upvote & Fund

Fund with Polar

moltar commented 7 months ago

And another thing, it doesn't seem to be copying the emitted dts files into the dist directory, even though it seems that it should be.

Yeah, I think there's a bug somewhere.

> tsup --config="tsup.config.json"

Analysis will use the bundled TypeScript version 5.0.4
*** The target project appears to use TypeScript 5.2.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
Writing package typings: .../packages/foo/lib/_tsup-dts-rollup.d.ts
Analysis will use the bundled TypeScript version 5.0.4
*** The target project appears to use TypeScript 5.2.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
Writing package typings: .../packages/projen-typescript-package-build/lib/_tsup-dts-rollup.d.mts
❯ tree lib
lib
├── index.js
├── index.js.map
├── index.mjs
├── index.mjs.map
└── src

2 directories, 4 files

The declarations (_tsup-dts-rollup.d.{ts,mts}) are missing.

ocavue commented 7 months ago

Could you share a minimal reproduction? Thanks!