Skip to content
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

Parcel 2 - Use tsc as default for TypeScript #5360

Closed
LukeTOBrien opened this issue Nov 17, 2020 · 2 comments
Closed

Parcel 2 - Use tsc as default for TypeScript #5360

LukeTOBrien opened this issue Nov 17, 2020 · 2 comments

Comments

@LukeTOBrien
Copy link

LukeTOBrien commented Nov 17, 2020

I am a big user of Parel, I use it in all my projects, now I thourght I'd better switch to using Parcel 2.

🙋 feature request

Use tsc rather than Babel as the default transformer for Typescript,

The default way of transforming TypeScript is using Babel.
However:

tsconfig.json is ignored, so language features like class properties, decorators need to be provided by a Babel plugin.

What % of TypeScript projects use a tsconfig.json?
I use a tsconfig in 100% of my TypeScript project, so in my case at least I am always going to manually configure to use tsc (which I never did in Parcel 1, it just worked)

It also seems that the reason Babel is the default is because:

because it is generally faster in our pipeline

So I suggest thouse developers who are in a hurry and need a super fast TypeScript transformer can configure Babel in the .rc, but for most cases developers will want to transform TypeScript as nature intended using tsc.
So I think tsc should be the default not Babel.

🔦 Context

I am building a Web Component repository using LitElement and the default Babel transformer ignores the tsconfig.json so the decorators I use in the component class throws and error:

× Build failed.
@parcel/transformer-babel: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (16:1):

I guess this would also throw an error for Angular projects as Angular heavily uses decorators.

🤔 Expected Behavior

Parcel 2 thows the above when encountering decorators,

😯 Current Behavior

Parcel should just work as Parcel 1 does.

@mischnic
Copy link
Member

Duplicate of #4022 / #4938

You can already use TSC with a single configuration file: https://v2.parceljs.org/languages/typescript/#typescript's-tsc

@LukeTOBrien
Copy link
Author

Yes but my point is that you shouldn't have to set any configuration, Parcel 1 I didn't set any configuration, but now I'm going to have to set the configuration on every project.
I will continue this discussion on one of the other treads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants