Support loading TypeScript metro.config.ts in Node.js v24#1560
Closed
robhogan wants to merge 1 commit into
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80275288 |
robhogan
added a commit
that referenced
this pull request
Aug 18, 2025
Summary: Take advantage of Node.js's unflagged TypeScript stripping/.ts module loading and allow Metro to find TypeScript config and load files with no additional dependencies, via the `.cts`, `.ts` and `.mts` extensions. We'll be able to make `.ts` the suggested format once Node v24.3 (where using TS is on by default and no longer emits a warning) is the minimum supported version. ``` - **[Feature]** Support loading TypeScript `metro.config.ts` files when using Node.js/Bun versions that natively support it ``` Reviewed By: GijsWeterings Differential Revision: D80275288
2be2d9f to
a100552
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80275288 |
robhogan
added a commit
that referenced
this pull request
Aug 18, 2025
Summary: Pull Request resolved: #1560 Take advantage of Node.js's unflagged TypeScript stripping/.ts module loading and allow Metro to find TypeScript config and load files with no additional dependencies, via the `.cts`, `.ts` and `.mts` extensions. We'll be able to make `.ts` the suggested format once Node v24.3 (where using TS is on by default and no longer emits a warning) is the minimum supported version. ``` - **[Feature]** Support loading TypeScript `metro.config.ts` files when using Node.js/Bun versions that natively support it ``` Reviewed By: GijsWeterings Differential Revision: D80275288
a100552 to
b25c00e
Compare
robhogan
added a commit
that referenced
this pull request
Aug 20, 2025
Summary: Take advantage of Node.js's unflagged TypeScript stripping/.ts module loading and allow Metro to find TypeScript config and load files with no additional dependencies, via the `.cts`, `.ts` and `.mts` extensions. We'll be able to make `.ts` the suggested format once Node v24.3 (where using TS is on by default and no longer emits a warning) is the minimum supported version. ``` - **[Feature]** Support loading TypeScript `metro.config.ts` files when using Node.js/Bun versions that natively support it ``` Reviewed By: GijsWeterings Differential Revision: D80275288
b25c00e to
5f694ca
Compare
Summary: Pull Request resolved: #1560 Take advantage of Node.js's unflagged TypeScript stripping/.ts module loading and allow Metro to find TypeScript config and load files with no additional dependencies, via the `.cts`, `.ts` and `.mts` extensions. We'll be able to make `.ts` the suggested format once Node v24.3 (where using TS is on by default and no longer emits a warning) is the minimum supported version. ``` - **[Feature]** Support loading TypeScript `metro.config.ts` files when using Node.js/Bun versions that natively support it ``` Reviewed By: GijsWeterings Differential Revision: D80275288
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D80275288 |
5f694ca to
abca73f
Compare
Contributor
|
This pull request has been merged in 8ba565c. |
facebook-github-bot
pushed a commit
that referenced
this pull request
Sep 30, 2025
Summary: In #1560, I added some logic to catch errors and throw more helpful ones (given the config path in a new message, and a specific note for the case that a user was trying to use TypeScript config on an older Node.js version). I preserved the original error in `error.cause`. However, the integration with `react-native-community/cli` discards the cause. This meant other run-of-the-mill errors in `metro.config.js` that prevented the module being evaluated, like a typo in a variable name, or a syntax error, were obscured. Instead, preserve the original error and stack, and just add a bit to the message before re-throwing it. Changelog: ``` - **[Fix]** Don't obscure errors parsing/evaluating metro.config.js ``` Reviewed By: motiz88 Differential Revision: D83559678 fbshipit-source-id: 82c9425463ad1c7833a14efce513d6ed2a657283
1 task
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
Take advantage of Node.js's unflagged TypeScript stripping/.ts module loading and allow Metro to find and load TypeScript config with no additional dependencies, via the
.cts,.tsand.mtsextensions.We'll be able to make
.tsthe suggested format once Node v24.3 (where using TS is on by default and no longer emits a warning) is the minimum supported version.Reviewed By: GijsWeterings
Differential Revision: D80275288