Skip to content

Commit 53f688f

Browse files
martinbigioMartin Konicek
authored andcommitted
Use default asset roots on default.config.js
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
1 parent ff6d9cc commit 53f688f

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

local-cli/default.config.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ var path = require('path');
1212
*/
1313
var config = {
1414
getProjectRoots() {
15-
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
16-
// packager is running from node_modules of another project
17-
return [path.resolve(__dirname, '../../..')];
18-
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
19-
// packager is running from node_modules of another project
20-
return [path.resolve(__dirname, '../../..')];
21-
} else {
22-
return [path.resolve(__dirname, '..')];
23-
}
15+
return getRoots();
2416
},
2517

2618
/**
@@ -29,7 +21,7 @@ var config = {
2921
* `./<image.extension>` don't require any entry in here.
3022
*/
3123
getAssetRoots() {
32-
return [];
24+
return getRoots();
3325
},
3426

3527
/**
@@ -41,4 +33,16 @@ var config = {
4133
}
4234
};
4335

36+
function getRoots() {
37+
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
38+
// packager is running from node_modules of another project
39+
return [path.resolve(__dirname, '../../..')];
40+
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
41+
// packager is running from node_modules of another project
42+
return [path.resolve(__dirname, '../../..')];
43+
} else {
44+
return [path.resolve(__dirname, '..')];
45+
}
46+
}
47+
4448
module.exports = config;

0 commit comments

Comments
 (0)