weiran-zsd / dts-cli

Zero-config CLI for TypeScript package development
MIT License
441 stars 23 forks source link

Take esbuild into consideration #107

Closed CRNRSTD closed 2 years ago

CRNRSTD commented 2 years ago

Current Behavior

Desired Behavior

tsdx has been around for quite some time. It does appear to me that the current (however undeniably awesome!) approach lost its momentum and there are other, newer tools (like mentioned in the title 'esbuild') we could wrap dts-cli around. Would love to hear your feedback

Suggested Solution

Who does this impact? Who is this for?

Probably most users

Describe alternatives you've considered

Additional context

Related: https://github.com/jaredpalmer/tsdx/issues/716

aladdin-add commented 2 years ago

dts is not mean to be a cutting-edge tool. It's to give users a safe and reliable choice with good defaults. Actually I had played esbuild in some of my other projects, but it's not fit for dts. I have a few concerns about the change:

  1. Production readiness: as said in its docs:

This project has not yet hit version 1.0.0 and is still in active development. That said, it is far beyond the alpha stage and is pretty stable. I think of it as a late-stage beta.

  1. extendibility. babel has its community - almost all the frameworks played well with it, you can even write your own plugin if needed.

  2. web compat. as I know, esbuild cannot compile to es5: https://github.com/evanw/esbuild/issues/297 But there are some devs want to support some old browsers like IE11(not upgradable for windows 7 users). We could use it in development mode (using rollup + babel in prod just like vite.js), but it also added a few complexities.

In all, esbuild is good for some users, while not fit for dts.

sidwebworks commented 2 years ago

True, there are projects like https://tsup.egoist.sh which use bubble to further convert code to ES5, though Babel still has a better and bigger ecosystem than Bubble, so for those reasons makes sense to stick to TSDX setup for reliability gains.