egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.

Home Page:https://tsup.egoist.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree-shaking documentation isn't clear enough.

wujekbogdan opened this issue · comments

The docs say that tree-shaking is enabled by default. It also says that setting it to true makes tsup use Rollup, rather than ESBuild, for tree-shaking. What's missing from the docs is:

  • What happens if treeshake is set to false? Does it disable tree-shaking entirely, or is it an equivalent of treeshake: undefined, which effectively turns it on but uses ESBuild rather than Rollup?
  • Does setting treeshake to true make the build process use Rollup for the entire build, or is Rollup somehow used for tree-shaking only?

I wonder if this is an issue with the docs or rather an issue with the API.

How about adding a new config property treeshakeType:

type TreeshakeType = 'rollup' | 'esbuild'

Then the current treeshake property would either accept a boolean (if treeshakeType : 'esbuild') or TreeshakingOptions (if treeshakeType: 'rollup')

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar