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 48cb144c2d
commit 888749220d
3 changed files with 4 additions and 1 deletions

View File

@ -340,6 +340,8 @@ class ResolutionRequest {
file = potentialModulePath + '.native.js'; file = potentialModulePath + '.native.js';
} else if (this._fastfs.fileExists(potentialModulePath + '.js')) { } else if (this._fastfs.fileExists(potentialModulePath + '.js')) {
file = potentialModulePath + '.js'; file = potentialModulePath + '.js';
} else if (this._fastfs.fileExists(potentialModulePath + '.jsx')) {
file = potentialModulePath + '.jsx';
} else if (this._fastfs.fileExists(potentialModulePath + '.json')) { } else if (this._fastfs.fileExists(potentialModulePath + '.json')) {
file = potentialModulePath + '.json'; file = potentialModulePath + '.json';
} else { } else {

View File

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

View File

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