Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be prefixed with an underscore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary because the function is not part of the object that is exported :)

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;