From 0893d07db197b4f78752f982abbc568c6c0c7419 Mon Sep 17 00:00:00 2001 From: James Ide Date: Mon, 25 Jan 2016 05:32:49 -0800 Subject: [PATCH] Revert "Enable JSX files extension" Summary: This reverts commit 888749220dac26382412f2c38ac5f9205cc842e5. The original commit didn't handle cases like .(ios|android|native).js, and vjeux is in favor of standardizing on .js instead of custom extensions like .jsx or .es6 everywhere. > Unfortunately this pull request doesn't implement with .ios.jsx. But, when/if it does, it raises more questions like what happens if you have both ios.js and ios.jsx? > > Sorry to chime in super late but I actually think that this is harmful to support .jsx extension. We now live in a world where we have many transforms for es6, flow, jsx... Why would we add .jsx but not .flow or .es6. Supporting more extensions is only going to fragment tools even more. https://github.com/facebook/react-native/pull/5233#discussion_r49682279 Closes https://github.com/facebook/react-native/pull/5296 Reviewed By: svcscm Differential Revision: D2830784 Pulled By: bestander fb-gh-sync-id: 9a7a4745803acbcbc5dba176b971c629c904bacd --- .../src/DependencyResolver/DependencyGraph/ResolutionRequest.js | 2 -- .../src/DependencyResolver/DependencyGraph/index.js | 2 +- packager/react-packager/src/Server/index.js | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js index 2c18c95a3..f67404393 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js @@ -350,8 +350,6 @@ class ResolutionRequest { file = potentialModulePath + '.native.js'; } else if (this._fastfs.fileExists(potentialModulePath + '.js')) { file = potentialModulePath + '.js'; - } else if (this._fastfs.fileExists(potentialModulePath + '.jsx')) { - file = potentialModulePath + '.jsx'; } else if (this._fastfs.fileExists(potentialModulePath + '.json')) { file = potentialModulePath + '.json'; } else { diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js index 1278d2ce8..1192159b3 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js @@ -55,7 +55,7 @@ class DependencyGraph { platforms: platforms || [], preferNativePlatform: preferNativePlatform || false, cache, - extensions: extensions || ['js', 'jsx', 'json'], + extensions: extensions || ['js', 'json'], mocksPattern, extractRequires, shouldThrowOnUnresolvedErrors, diff --git a/packager/react-packager/src/Server/index.js b/packager/react-packager/src/Server/index.js index 3bb8a9c0e..99a3472d6 100644 --- a/packager/react-packager/src/Server/index.js +++ b/packager/react-packager/src/Server/index.js @@ -151,7 +151,6 @@ class Server { dir: dir, globs: [ '**/*.js', - '**/*.jsx', '**/*.json', ].concat(assetGlobs), };