Skip to content

Commit 1777498

Browse files
obladorthymikee
authored andcommitted
fix: pass --projectRoot argument to Metro (#259)
1 parent 6457cbd commit 1777498

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

packages/cli/src/commands/server/runServer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async function runServer(argv: Array<string>, ctx: ContextT, args: Args) {
5151
port: args.port,
5252
resetCache: args.resetCache,
5353
watchFolders: args.watchFolders,
54+
projectRoot: ctx.root,
5455
sourceExts: args.sourceExts,
5556
reporter,
5657
});

packages/cli/src/tools/loadMetroConfig.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const getDefaultConfig = (ctx: ContextT) => {
7373
export type ConfigOptionsT = {|
7474
maxWorkers?: number,
7575
port?: number,
76+
projectRoot?: string,
7677
resetCache?: boolean,
7778
watchFolders?: string[],
7879
sourceExts?: string[],
@@ -85,20 +86,8 @@ export type ConfigOptionsT = {|
8586
*
8687
* This allows the CLI to always overwrite the file settings.
8788
*/
88-
export default (async function load(
89-
ctx: ContextT,
90-
// $FlowFixMe - troubles with empty object being inexact
91-
options?: ConfigOptionsT = {},
92-
) {
89+
export default function load(ctx: ContextT, options?: ConfigOptionsT) {
9390
const defaultConfig = getDefaultConfig(ctx);
9491

95-
const config = await loadConfig(
96-
{
97-
cwd: ctx.root,
98-
...options,
99-
},
100-
defaultConfig,
101-
);
102-
103-
return config;
104-
});
92+
return loadConfig({cwd: ctx.root, ...options}, defaultConfig);
93+
}

0 commit comments

Comments
 (0)