Skip to content

Commit

Permalink
Use default asset roots on default.config.js
Browse files Browse the repository at this point in the history
Summary: We need to cherry pick this one as well.

cc ide
Closes #3640

Reviewed By: svcscm

Differential Revision: D2577961

Pulled By: mkonicek

fb-gh-sync-id: 3368fc02a931e0f259f3baa6706bd7d8586b0fbf
  • Loading branch information
martinbigio authored and Martin Konicek committed Oct 27, 2015
1 parent ff6d9cc commit 53f688f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions local-cli/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ var path = require('path');
*/
var config = {
getProjectRoots() {
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else {
return [path.resolve(__dirname, '..')];
}
return getRoots();
},

/**
Expand All @@ -29,7 +21,7 @@ var config = {
* `./<image.extension>` don't require any entry in here.
*/
getAssetRoots() {
return [];
return getRoots();
},

/**
Expand All @@ -41,4 +33,16 @@ var config = {
}
};

function getRoots() {
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else {
return [path.resolve(__dirname, '..')];
}
}

module.exports = config;

0 comments on commit 53f688f

Please sign in to comment.