vitejs / vite-plugin-react

The all-in-one Vite plugin for React projects.
MIT License
546 stars 102 forks source link

ESBuild supports decorators now #314

Closed pnegahdar closed 1 month ago

pnegahdar commented 1 month ago

Description

ESBuild added support for decorators in 0.21. Hopefully this means a lot of projects can kill their usage of babel.

https://github.com/evanw/esbuild/issues/104#issuecomment-2097359571

I attempted to simply drop the babel config in the react() plugin and set the esbuild: {target: "es2022"} and that didn't seem to work.

Do we have to wait for a new release or can we force it to use the feature with the right configuration? It's not clear to me how the puglin decides whether to use babel or not (it seems to even when I don't have have a babel config it does.

Suggested solution

Describe configuration to use latest esbuild with decorator support or bump the package?

Alternative

No response

Additional context

No response

Validations

ArnaudBarre commented 1 month ago

You will need Vite to ship the new version of esbuild that was marked as breaking change by safety by Evan Wallace. This is plan for 5.3 that should be shipped this month. You can follow this issue for updates: https://github.com/vitejs/vite/issues/16616