Skip to content

Commit

Permalink
Merge pull request #145 from c-h-/master
Browse files Browse the repository at this point in the history
Allow react-native-macos package.json shims
  • Loading branch information
ptmt authored Feb 11, 2017
2 parents bc703d7 + 375d662 commit 8c1a2b8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packager/react-packager/src/node-haste/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,26 @@ class Package {
}

function getReplacements(pkg) {
let rnm = pkg['react-native-macos'];
let rn = pkg['react-native'];
let browser = pkg.browser;
if (rn == null) {

if (rnm == null && rn == null) {
return browser;
}

if (browser == null) {
if (rnm == null && browser == null) {
return rn;
}

if (rn == null && browser == null) {
return rnm;
}

if (typeof rnm === 'string') {
rnm = { [pkg.main]: rnm };
}

if (typeof rn === 'string') {
rn = { [pkg.main]: rn };
}
Expand All @@ -127,8 +137,9 @@ function getReplacements(pkg) {
}

// merge with "browser" as default,
// "react-native" as override
return { ...browser, ...rn };
// "react-native" as override 1
// "react-native-macos" as override 2
return { ...browser, ...rn, ...rnm };
}

module.exports = Package;

0 comments on commit 8c1a2b8

Please sign in to comment.