Do not try to parse .ts configs as JSON if natively supported#17052
Merged
nicolo-ribaudo merged 2 commits intobabel:mainfrom Jan 17, 2025
Merged
Do not try to parse .ts configs as JSON if natively supported#17052nicolo-ribaudo merged 2 commits intobabel:mainfrom
nicolo-ribaudo merged 2 commits intobabel:mainfrom
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58546 |
15fa070 to
da3629e
Compare
nicolo-ribaudo
commented
Jan 9, 2025
| if (ext !== ".cts") { | ||
| throw new ConfigError( | ||
| `\ | ||
| You are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either: |
Member
Author
There was a problem hiding this comment.
This error is "new", but before we would try to parse the files as JSON and thus just give a worse error.
JLHwung
approved these changes
Jan 10, 2025
liuxingbaoyu
approved these changes
Jan 17, 2025
Member
Author
|
Note that this PR does not add automatic support for automatically finding |
Tobbe
added a commit
to Tobbe/redwood
that referenced
this pull request
Mar 14, 2025
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
Tobbe
added a commit
to redwoodjs/graphql
that referenced
this pull request
Mar 15, 2025
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
Tobbe
added a commit
to redwoodjs/graphql
that referenced
this pull request
Mar 25, 2025
Changes since the last version: babel/babel#17142 babel/babel#17127 babel/babel#17052
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1, Fixes #2Node.js 23.6 has native support for
.ts/.mts/.ctsfiles. However, they don't work in Babel because we wrongly try to parse them as JSON.With this PR:
.ctsfilesI'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