From ef21d99ded9cc06f3091ee2ea58b8f64e82aa0ad Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Fri, 20 May 2016 05:27:13 -0700 Subject: [PATCH] Adds packager configuration to support windows platform Summary: This pull request is a prerequisite to enabling the react-native-windows platform extension. In the Resolver component, we need to add 'windows' to the list of platforms that are allowed in the DependencyGraph. We also need to add 'react-native-windows' (the name of the Windows platform extension NPM module) to the `providesModuleNodeModules` option. This allows the node_module folder check in the DependencyGraphHelper from node-haste to be bypassed for *.windows.js files in the Windows NPM package. For good measure, I also included a change to blacklist.js to ensure .windows.js files are ignored when the packager is parameterized on a platform. Closes https://github.com/facebook/react-native/pull/7639 Differential Revision: D3327771 Pulled By: mkonicek fbshipit-source-id: d1080b045ff6aa0cbf05d8070ceb0eb4cdb6dceb --- packager/blacklist.js | 8 ++++++++ packager/react-packager/src/Resolver/index.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packager/blacklist.js b/packager/blacklist.js index 2a1346f97ce706..3b222145c42a3c 100644 --- a/packager/blacklist.js +++ b/packager/blacklist.js @@ -27,14 +27,22 @@ var platformBlacklists = { web: [ '.ios.js', '.android.js', + '.windows.js' ], ios: [ '.web.js', '.android.js', + '.windows.js', ], android: [ '.web.js', '.ios.js', + '.windows.js' + ], + windows: [ + '.web.js', + '.ios.js', + '.android.js' ], }; diff --git a/packager/react-packager/src/Resolver/index.js b/packager/react-packager/src/Resolver/index.js index 89fd40b96ebc16..5f5dc98e6569b0 100644 --- a/packager/react-packager/src/Resolver/index.js +++ b/packager/react-packager/src/Resolver/index.js @@ -95,13 +95,14 @@ class Resolver { providesModuleNodeModules: [ 'react', 'react-native', + 'react-native-windows', // Parse requires AsyncStorage. They will // change that to require('react-native') which // should work after this release and we can // remove it from here. 'parse', ], - platforms: ['ios', 'android'], + platforms: ['ios', 'android', 'windows'], preferNativePlatform: true, fileWatcher: opts.fileWatcher, cache: opts.cache,