roots / bud

High-performance build system that supports SWC, esbuild, and Babel
https://bud.js.org/
MIT License
339 stars 38 forks source link

[planned] don't include fallback js transpilers #2076

Open kellymears opened 1 year ago

kellymears commented 1 year ago

Agreement

The feature

It seemed like a good idea to include a fallback transpiler but it complicates things a lot more than anticipated. If you aren't using babel then it's also pretty substantial baggage.

In bud@7.0.0 I would like to require projects specify the transpiler of their choice as a dependency.

Use case

For example, in a React project using bud@6.0 you could install:

This implicitly includes @roots/bud-babel. If you install another transpiler it takes precedence over the babel default. So, this set of dependencies will end up using swc instead of babel:

This seems cool but it means a fair bit of extra code, mostly conditional statements related to inferring which transpiler is installed. It's not really costly computation but it is messy and when we get it wrong it can be frustrating.

If you're using some other transpiler you still wind up with babel installed, which is wasteful.

In the case of @roots/bud-typescript the user may very well want to use both @roots/bud-babel along with @roots/bud-typescript. How do we know if they intended to? Right now users can be explicit by calling bud.typescript.useBabel() but this seems like it's having the opposite of the intended effect: it's complicating things instead of simplifying them.

In bud@7.0.0 I'd like to just have the user simply pick for their project upfront.

For swc:

For tsc:

For tsc and babel:

For esbuild:

For babel:

This is a breaking change as the choice will be required.

Notes

Affected extensions:

github-actions[bot] commented 1 year ago

Message to comment on stale issues. If none provided, will not mark issues stale