fix(packager): support node-haste browser and react-native replacements on Windows

Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

Fix issue with browser and react-native module mappings in node-haste when running the packager from Windows.

**Test plan (required)**

Tested on the NPM package uuid, which has a browser mapping, and it worked.

Fixes #9570
Closes https://github.com/facebook/react-native/pull/9572

Differential Revision: D3821761

Pulled By: davidaurelio

fbshipit-source-id: ebbd91f9e3215385afe3b81a97a962b45a6286f9
This commit is contained in:
Eric Rozell 2016-09-06 08:52:17 -07:00 committed by Facebook Github Bot 4
parent 4fffdc3b58
commit 2bf4fff849
1 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ class Package {
return name;
}
if (name[0] !== '/') {
if (!isAbsolutePath(name)) {
const replacement = replacements[name];
// support exclude with "someDependency": false
return replacement === false
@ -66,11 +66,11 @@ class Package {
: replacement || name;
}
if (!isAbsolutePath(name)) {
throw new Error(`Expected ${name} to be absolute path`);
let relPath = './' + path.relative(this.root, name);
if (path.sep !== '/') {
relPath = relPath.replace(path.sep, '/');
}
const relPath = './' + path.relative(this.root, name);
let redirect = replacements[relPath];
// false is a valid value