Skip to content

Commit

Permalink
Add 'jsx' to resolver.sourceExts defaults
Browse files Browse the repository at this point in the history
Summary:
Widens the default config value for `resolver.sourceExts` to include `.jsx` file extensions. This mirrors us already supporting both `.ts` and `.tsx` out of the box, and [aligns with create-react-app](https://github.com/facebook/create-react-app/blob/f34d88e30c7d8be7181f728d1abc4fd8d5cd07d3/packages/react-scripts/config/webpack.config.js#L356).

Changelog:

**[Breaking]** With a default config, any `.jsx` files will now be resolved before `.json`, `.ts`, `.tsx`

Reviewed By: robhogan

Differential Revision: D37881467

fbshipit-source-id: cb16eb9b190e9f3f5666fd48b11a12feba8a53f1
  • Loading branch information
huntie authored and facebook-github-bot committed Jul 27, 2022
1 parent 75ac509 commit 1b47931
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Object {
],
"sourceExts": Array [
"js",
"jsx",
"json",
"ts",
"tsx",
Expand Down Expand Up @@ -224,6 +225,7 @@ Object {
],
"sourceExts": Array [
"js",
"jsx",
"json",
"ts",
"tsx",
Expand Down Expand Up @@ -380,6 +382,7 @@ Object {
],
"sourceExts": Array [
"js",
"jsx",
"json",
"ts",
"tsx",
Expand Down Expand Up @@ -536,6 +539,7 @@ Object {
],
"sourceExts": Array [
"js",
"jsx",
"json",
"ts",
"tsx",
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-config/src/defaults/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.assetExts = [

exports.assetResolutions = ['1', '1.5', '2', '3', '4'];

exports.sourceExts = ['js', 'json', 'ts', 'tsx'];
exports.sourceExts = ['js', 'jsx', 'json', 'ts', 'tsx'];

exports.moduleSystem = (require.resolve(
'metro-runtime/src/polyfills/require.js',
Expand Down

0 comments on commit 1b47931

Please sign in to comment.