Skip to content

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

@kellymears

Description

@kellymears

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:

  • @roots/bud
  • @roots/bud-react

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:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-swc

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:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-swc

For tsc:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-typescript

For tsc and babel:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-typescript
  • @roots/bud-babel

For esbuild:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-esbuild

For babel:

  • @roots/bud
  • @roots/bud-react
  • @roots/bud-babel

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

Notes

Affected extensions:

  • @roots/bud-react includes @roots/bud-babel as a fallback
  • @roots/bud-preset-recommend includes @roots/bud-babel as a fallback

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions