Why use babel? #345
-
For the Typescript natively supports TSX syntax, and a bunch of other things. I would like to use the "Explicit Resource Management" syntax in my code but in both CRA and vite I get an error from babel saying the syntax isn't enabled and (at least for CRA) I need to install a babel plugin for it!? ERM was added to Typescript in version 5.2, and we're currently at 5.5. I've also noticed a plugin was required for JS private properties (those beginning with What does babel do that tsc can't already? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To have HMR with React for good DX in dev, we need to integrate https://www.npmjs.com/package/react-refresh TSC doesn't support this transformation natively. And TSC is not used for transpilng anyway because it's too slow (only in 5.5 they added a short path for emmiting without typechecking). TSX transformation is done via esbuild, which sadly doesn't support fast refresh (I did a PR for that without success) I'm surprised that this two features aren't supported by babel yet. I'll look at it in the week |
Beta Was this translation helpful? Give feedback.
To have HMR with React for good DX in dev, we need to integrate https://www.npmjs.com/package/react-refresh
This also requires some code updates which is implemented today only in Babel (via a plugin) and SWC.
TSC doesn't support this transformation natively. And TSC is not used for transpilng anyway because it's too slow (only in 5.5 they added a short path for emmiting without typechecking). TSX transformation is done via esbuild, which sadly doesn't support fast refresh (I did a PR for that without success)
I'm surprised that this two features aren't supported by babel yet. I'll look at it in the week