Enable JSX files extension

Summary:
JSX extension is much used in React, this would be a natural addition for React Native.
See: https://github.com/facebook/react-native/issues/2303
Closes https://github.com/facebook/react-native/pull/5233

Reviewed By: svcscm

Differential Revision: D2818888

Pulled By: mkonicek

fb-gh-sync-id: 856d1b8ba9ff88ba08a00923174e3284f359d774
This commit is contained in:
Kelvin De Moya 2016-01-12 08:24:42 -08:00 committed by facebook-github-bot-7
parent 0001c20760
commit e35b8f1724
3 changed files with 4 additions and 1 deletions

View File

@ -340,6 +340,8 @@ 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 {

View File

@ -55,7 +55,7 @@ class DependencyGraph {
platforms: platforms || [],
preferNativePlatform: preferNativePlatform || false,
cache,
extensions: extensions || ['js', 'json'],
extensions: extensions || ['js', 'jsx', 'json'],
mocksPattern,
extractRequires,
shouldThrowOnUnresolvedErrors,

View File

@ -151,6 +151,7 @@ class Server {
dir: dir,
globs: [
'**/*.js',
'**/*.jsx',
'**/*.json',
].concat(assetGlobs),
};