-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to TSC transformer instead of Babel by default #4938
Comments
I wonder if this is the best criteria for deciding if TSC is OK as the default. Mainly, I would be surprised if there are actually any large TypeScript projects that didn't have a tsconfig / use TSC already. |
Having a tsconfig and using TSC for compilation are two different things. For example, you could have a tsconfig for type checking and editor integration, but use Babel for compilation. This is how popular tools like create-react-app and Next.js work. |
I prefer |
|
Suppose that we tried this on a moderately sized project and it failed. Is it worth filing bugs now, or if/when |
Yes |
I've given this a a go again, and this time I think I'm getting a TypeScript 3 compat error? Is that expected / worth filing an issue for?
|
An update on this: We are now transpiling TypeScript with SWC by default as of #6230. It is an order of magnitude faster than both Babel and TSC. It also fixes several issues that people had with using Babel as a transpiler for TypeScript. I think this changes the equation for what should be the default in Parcel significantly. Perhaps we should attempt to read |
As of #6501 we are loading some settings from tsconfig.json and applying them via SWC. Currently we support settings for JSX and enabling decorators, which are the only compiler features that have to be enabled and are not part of the default configuration. As more experimental features are added, we will also support those. Going to close this issue. If you want to use TSC, you still can by using |
We should measure the performance impact of doing this first. However, based on issues, it seems fairly clear that the Babel-based TypeScript support that we have now is too limited.
@babel/preset-typescript
doesn't enable all of the language features that TSC does, e.g. decorators, class properties, optional chaining, etc. This causes confusion for people.We could either attempt to match the features that TSC supports in our default config, or just run TSC first, and then Babel like we did in v1. The main issue is that when you add a custom Babel config, you'd need to re-create our default yourself, which might also be confusing.
The action items here are:
@parcel/transformer-typescript-tsc
for.ts
and.tsx
files instead of babel, and measure the performance impact.The text was updated successfully, but these errors were encountered: