-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Do not try to parse .ts configs as JSON if natively supported #17052
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
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58546 |
15fa070
to
da3629e
Compare
if (ext !== ".cts") { | ||
throw new ConfigError( | ||
`\ | ||
You are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is "new", but before we would try to parse the files as JSON and thus just give a worse error.
Note that this PR does not add automatic support for automatically finding |
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
Fixes #1, Fixes #2
Node.js 23.6 has native support for
.ts
/.mts
/.cts
files. However, they don't work in Babel because we wrongly try to parse them as JSON.With this PR:
.cts
filesI'd consider this PR to be a bugfix, since it only changes the behavior in Node.js 23.6 to not respect what Node.js already supports by itself. It's a new Node.js feature, and not a new Babel feature.
Ref #17051