Permalink
Browse files

fix(packager): support node-haste browser and react-native replacemen…

…ts 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 #9572

Differential Revision: D3821761

Pulled By: davidaurelio

fbshipit-source-id: ebbd91f9e3215385afe3b81a97a962b45a6286f9
1 parent 8451585 commit 4647b62f4de9f41ade680bbb90da7d11e2c79547 @rozele rozele committed with Facebook Github Bot 4 Sep 6, 2016
Showing with 4 additions and 4 deletions.
  1. +4 −4 packager/react-packager/src/node-haste/Package.js
@@ -58,19 +58,19 @@ class Package {
return name;
}
- if (name[0] !== '/') {
+ if (!isAbsolutePath(name)) {
const replacement = replacements[name];
// support exclude with "someDependency": false
return replacement === false
? false
: 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

0 comments on commit 4647b62

Please sign in to comment.